[Aldor-l] exporting a domain in aldor - final update
Ralf Hemmecke
ralf at hemmecke.de
Tue Jan 2 07:51:01 EST 2007
Hi Martin,
Your code did not compile at my place.
woodpecker:~/scratch>aldor aaa.as
"aaa.as", line 3: define MyCat: Category == OutputType with f: () -> %;
.....................................^
[L3 C38] #1 (Error) Improper form appearing within a declaration.
So I added braces around the function signature.
And for the "pretend" you can hide it with the usual "per", but you have
to import from Integer or from Rep in order to let the compiler know
what to do with a literal that looks like an integer.
DomA: Cat == add {
local MyDom: MyCat == Integer add {
Rep == Integer;
import from Rep;
f(): % == per 1783;
}
Dom: MyCat == MyDom;
}
I didn't have time to figure out exactly why you need that and whether
it is the right design for your problem.
Ralf
On 01/02/2007 01:31 PM, Martin Rubey wrote:
> By chance, I figured out how to make my original plan work out. One has to add
> a "local" to make the compiler happy:
>
> Martin Rubey <martin.rubey at univie.ac.at> writes:
>
> #include "aldor"
>
> define MyCat: Category == OutputType with f: () -> %;
>
> define Cat: Category == with {
> Dom: MyCat;
> }
>
> DomA: Cat == add {
> local MyDom: MyCat == Integer add {
> Rep == Integer;
> f(): % == 1783 pretend %;
> }
> Dom: MyCat == MyDom;
> }
>
> Note that aldor doesn't like Rep, so one has to use pretend %, but I think
> that's something rather minor.
>
> This works for Axiom, too.
>
> Happy now.
>
> Martin
More information about the Aldor-l
mailing list