> 'is' however is something else. It invites the programmer to deal with
> specific cases rather than the most general case.

I'd would discourage 'is' for such a case.

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 don't say that I am completely happy with the code at all, since 
'Object' as presented in the AUG is not really one of my favourite 
types. (Same for Any, but this is a another story.)

Ralf

---
define ObjectLabelType: Category == with {
         LabelType;
        label: (Lab: LabelType, Lab) -> %;
        explode: % -> (Lab: LabelType, Lab);
}
Label: ObjectLabelType == add {
         macro LT == LabelType;
        Rep == Record(LabDom: LabelType, label: LabDom);
         import from Rep;
        label(Lab: LabelType, l: Lab): % == per [Lab, l];
        explode(x: %): (Lab: LabelType, Lab) == explode rep x;
        equals?(X: LT, x: X)(Y: LT, y: Y): Boolean == {
                 -- We must check whether X is the same domain
                 -- as Y. We can do that by asking whether
                 if List X has ListType Y then {
                         (x = y pretend X)
                 } else {
                         false;
                 }
        }
        (x: %) = (y: %): Boolean == equals?(explode x)(explode y);
         ...
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to