axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Unions in Spad


From: Bill Page
Subject: Re: [Axiom-developer] Unions in Spad
Date: Sun, 8 Jul 2007 21:40:40 -0400

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.

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.

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.

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.

Regards,
Bill Page.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]