[Aldor-l] exports and constants
Bill Page
bill.page1 at synthesis.anikast.ca
Sun Jul 23 22:33:34 EDT 2006
On July 21, 2006 4:06 AM Ralf Hemmecke wrote:
> ...
> Christian Aistleitner wrote:
> >
> > I'd consider that a bug in comparison of exports. Replacing
> > your (*) line by
> >
> > X: CatX == if true then (A at CatX) else (B at CatX);
> >
> > gives a working program with output
> >
> > X has CatA: T
> > X has CatB: F
> > X has CatX: T
> >
> > So the problem (wild guess) is that the compiler Has
> > problems with seeing that the if statement gives CatX in
> > both branches of the if statement. Mainly because the
> > types of A and B aro not equal. However, you can hint the
> > compiler. My code is telling him "The if part gives
> > CatX and the else part gives CatX". Then the compiler can
> > infer, that the whole "if" statement gives CatX. And it is
> > at least the type of X (which is CatX). So it matches.
>
> COOL! So without the "add" the compiler gives X the type of
> what it sees on the right of "==". Now you declare that through
> "@CatX" to be CatX. But, hey, why then you get
>
> X has CatA: T
>
> ??? That looks like cheating.
Ralf, I seems to me you might be using the wrong definition of
"type". In Aldor when we write:
X: CatX
it means explicitly that the type of X is CatX. And we are
saying that it is the compiler's job to check (at compile time)
that this is necessarily always the case.
But 'X has CatA' is something different. I think Christian
referred to it earlier as something like the "dynamic type"?
But in the Aldor User's Guide this is just called
"type satisfaction".
Regards,
Bill Page.
More information about the Aldor-l
mailing list