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: Stephen Wilson
Subject: Re: [Axiom-developer] Unions in Spad
Date: 08 Jul 2007 17:51:54 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Ralf Hemmecke <address@hidden> writes:

> Hello Stephen,
> 
> > 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)
> 
> SPAD seems to allow
> 
> u: Union(Integer, String) := ...
> if u case Integer then ...
> 
> I am not aware of the fact that Aldor can do this. And in the Aldor
> User Guide I have only found tagged unions.
> 
> How does now actually distinguish branches. My code above was actually
> only a guess. I have no idea whether that works in SPAD. In Aldor it
> doesn't.

Your correct that this would work in Spad.

I have not tried to get any insight from Aldor yet.  I seem to recall
that Aldor's handling of these types is somewhat broken, too.

But I think Aldor's treatment of selectors as elements of type
Enumeration is worth looking at and possibly worth making explicit in
Spad.  Spad seems to follow similar semantics conceptually but I cant
see the direct connection to the type system at this time.


Thanks,
Steve









reply via email to

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