[Aldor-l] exports and constants
Christian Aistleitner
tmgisi at gmx.at
Fri Jul 21 03:47:16 EDT 2006
Hello,
>> > You can interpret both kinds as "provides at least".
>
> No, I don't think that is true.
Can you provide an example where you cannot interprete it as "provides at
least"?
>> >> Take for example
>> >>
>> >> A: Join(CatA, CatX) == add {...}
>> >> B: Join(CatB, CatX) == add {...}
>> >> X: CatX == if odd? random() then A else B;
>
> The reason of course is because the expression 'odd? random()'
> is not static - it does not have a well-defined value at the
> time that the source is compiled. It is only later when the
> code is run that we can know if the condition is true or false
> in a particular instance. The Aldor compiler is not able to
> compile *types* of this kind.
I see, that the compiler is not able to compile this. We all agree on
that. But I cannot see mhy the "odd? random()" is the problem. From my
point of view, the "if" is the problem. Ralf already provided an example,
where
X: CatX == if true then (A add) else (B add);
worked, while
X: CatX == if true then A else B;
did not. In this example "true" takes the place of "odd? random()". "true"
is static as could be and still the problem remains. Therefore I doubt
that "odd? random()" is the problem. Type inference across the "if"
statement is the problem. As I showed in
http://www.aldor.org/pipermail/aldor-l/2006-July/000228.html
, hinting the comiler by "@" works perfectly well.
--
Kind regards,
Christian
More information about the Aldor-l
mailing list