[Aldor-l] exporting a domain in aldor
Martin Rubey
martin.rubey at univie.ac.at
Mon Jan 1 14:21:43 EST 2007
Dear Aldor experts,
I'd like to do the following, or something similar:
#include "aldor"
define Cat: Category == with {
Dom: OutputType;
f: () -> Dom;
}
DomA: Cat == add {
Dom: OutputType == Integer;
f(): Dom == 1783;
}
DomB: Cat == add {
Dom: OutputType == String;
f(): Dom == "abcd";
}
Of course, the code above does not work, since Dom has forgotten all the
properties of Integer and String. But I hope that there is some other way to
achieve the same thing. Of course, in real life, DomA and DomB have Rep's, and
the exported constant Dom should be something like a second Rep.
Note that
f(): Dom == 1783 pretend Dom;
results in a segmentation fault - at least in the interpreter.
Any ideas would be greatly appreciated. I don't really want to modify the Rep
to be
Rep = Union(r: OldRep, s: String);
and have to check the type of objects of type % all the time... Although, I
guess for interfacing with Axiom this is the only possibility anyway :-(
Martin
PS: Is there any hope for having the aldor compiler available soon?
More information about the Aldor-l
mailing list