[Aldor-l] [fricas-devel] Re: [fricas-devel] Re: "has" in the interpreter

Ralf Hemmecke ralf at hemmecke.de
Wed Nov 19 16:42:35 EST 2008


On 11/19/2008 10:22 PM, Bill Page wrote:
> On Wed, Nov 19, 2008 at 3:30 PM, Ralf Hemmecke wrote:
>> In some experimental code, I had myself some need of 'is' in Aldor.
>> Since there is no 'is' I used some workaround.
>>
>> Here I don't need it for selecting special cases, but rather to check
>> whether the domains are identical so that I could safely 'pretend'
>> that one value 'y' of type Y is also of type X.
>>
>> Instead of the line
>>                 if List X has ListType Y then {
>> you should read
>>                 if X is Y then {
>> .
> 
> I do not understand. If two domains are identical than why is there
> any need to "pretend" that they are the same?

You removed too much from my mail (at least if I understand your 
question correctly).

     equals?(X: LT, x: X)(Y: LT, y: Y): Boolean == {
                 if List X has ListType Y then {
                         (x = y pretend X)
                 } else {
                         false;
                 }
     }

equals? works on 4 things. X and Y are domains which both belong to 
category LT. Now, my construction is a workaround for the missing 'is' 
and therefore the compiler (after having interpreted 'List X has 
ListType Y') is not (yet) smart enough to figure out that X and Y are 
identical and in the 'then' branch y could actually equally be 
considered to be of type X (without 'pretend').

If 'is' were part of the (Aldor-)language, then of course, inside the 
'then' branch the compiler should not require 'pretend', i.e. 'x=y' 
should just work.

But we speak in dreams here. The only thing mentioned about 'is' in the 
AUG is that it is a reserved keyword.

Ralf



More information about the Aldor-l mailing list