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: Mon, 9 Jul 2007 12:38:25 -0400

On 7/9/07, Ralf Hemmecke <address@hidden> wrote:
...
Anyway, I would not say that Aldor does not allow
"Union(Integer,String)". No hint in the AUG, but look at the error
message given in
http://lists.nongnu.org/archive/html/axiom-developer/2007-07/msg00181.html

If you rewrite this program to

     U == Union(machInt: MachineInteger, sStr: String);

(just change this line) and then look at the error message.

woodpecker:~/scratch>aldor -laldor -fx aaa.as
"aaa.as", line 13:         if u case MachineInteger then {
                    ..................^
[L13 C19] #1 (Error) Argument 2 of `case' did not match any possible
parameter type.
     The rejected type is Join(
                 PrimitiveType with
                     ....
     Expected one of:
       -- Enumeration(machInt: Type)
       -- Enumeration(sStr: Type)

It looks as if one also could do

   if u case MachineInteger then ...

with the current Aldor compiler, I just don't know how to type
"MachineInteger" since the compiler immediately takes the *type*
MachineInteger and not the *tag* MachineInteger.


Use quotes like this?

 'MachineInteger'

That makes in a member of an Enumeration. Maybe that is what Aldor expects?

Anyway, that usage of MachineInteger is not specified in the AUG so
maybe one better does not use it that way.


I have become quite confident that Aldor takes the most general road
whenever possible inspite of what might or might not be written in the
user's guide, so I am inclined to think that you are right.
'Union(Integer,String)' might very well be acceptible to the Aldor
compiler, we just need to intuit the proper usage.

Regards,
Bill Page.




reply via email to

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