[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Unions in Spad
From: |
Stephen Wilson |
Subject: |
Re: [Axiom-developer] Unions in Spad |
Date: |
08 Jul 2007 22:09:03 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
"Bill Page" <address@hidden> writes:
> On 08 Jul 2007 15:21:52 -0400, Stephen Wilson wrote:
> >
> > Spad, internally, has two notions of Unions. The first variety might
> > be termed `regular', the other is, not surprisingly, termed `new'.
> >
> > Regular Unions do not have tags associated with branches. For example:
> >
> > Union(Integer, String)
> >
> > New Unions have tags, as in
> >
> > Union(int: Integer, str: String)
> >
> > The shortcoming is how these two flavors interact. Currently, Unions
> > are of one kind or the other. But this fact is nowhere asserted, and
> > blending the two types leads to obscure errors. For example:
> >
> > Union(int: Integer, String)
> >
> > I would appreciate any input if the above `hybrid' Union is useful or
> > desirable.
> >
>
> I think it is undesirable.
OK. I personally agree.
> > If so, I have a strategy to make such Unions usable (but it may be a
> > while before I find the time to implement it). If not, then there is
> > an easy fix to assert the uniformity of Union branches.
> >
>
> I think mixed union constructions should be consider syntax errors.
I personally agree as well. Unfortunately, the current Spad parser
is, well, difficult to change. I can check the uniformity of Union
branches at a post-parsing stage to at least get the assertion into
the system. Perhaps in time my new parser could be used as a full
replacement for the current one.
> Also it seems to me that the untagged union construction should be
> flagged by the SPAD compiler as deprecated so that the library code
> can eventually be updated to use the new tagged form that is
> compatible with Aldor.
There is a lot of code which uses the untagged union, so the
conversion would be a fair bit of work. I could experiment with such
a change in the Axisp repo and solicit everyones help in changing the
Algebra. In time, we might be able to get a changeset together which
could be applied to Silver. Any thoughts on this?
> One might be tempted to argue that the untagged form is more readable
> but I think the complications associated with the semantics of things
> like:
>
> Union(Integer,Integer)
>
> out weigh any linguistic advantage.
Absolutely, but this too could be flagged as an error by the compiler.
>
> Regards,
> Bill Page.
Take care,
Steve
- rep, per, Rep in SPAD/Aldor, was: Re: [Axiom-developer] Unions in Spad, (continued)
- rep, per, Rep in SPAD/Aldor, was: Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13
- Re: rep, per, Rep in SPAD/Aldor, was: Re: [Axiom-developer] Unions in Spad, Gabriel Dos Reis, 2007/07/13
- [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Ralf Hemmecke, 2007/07/13
- [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Gabriel Dos Reis, 2007/07/14
- [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Ralf Hemmecke, 2007/07/14
- Re: [Axiom-developer] Re: rep, per, Rep in SPAD/Aldor, Gabriel Dos Reis, 2007/07/14
- [Axiom-developer] Re: [Aldor-l] rep, per, Rep in SPAD/Aldor, Christian Aistleitner, 2007/07/14
- Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/13
- Re: [Axiom-developer] Unions in Spad, Stephen Wilson, 2007/07/13
Re: [Axiom-developer] Unions in Spad, Bill Page, 2007/07/08
- Re: [Axiom-developer] Unions in Spad,
Stephen Wilson <=
Re: [Axiom-developer] Unions in Spad, Waldek Hebisch, 2007/07/09
Re: [Axiom-developer] Unions in Spad, Bill Page, 2007/07/09
Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/09
Re: [Axiom-developer] Unions in Spad, Bill Page, 2007/07/09
Re: [Axiom-developer] Unions in Spad, Bill Page, 2007/07/09
Re: [Axiom-developer] Unions in Spad, Ralf Hemmecke, 2007/07/09
Re: [Axiom-developer] Unions in Spad, Bill Page, 2007/07/09