[Aldor-l] Specifying properties of functions

Christian Aistleitner tmgisi at gmx.at
Tue Mar 29 01:35:02 EST 2005


Hi Martin,

> one way to get it to compile is to say
>
> define MyCommutativeRing: Category == with {MyRing; *: (%, %) -> Integer;
>                                             Commutative(%, *$%)};
>
> however, I was unable to determine whether that would "work".

maybe I am wrong, but this did not work with my Aldor compiler.
In your „with” statement, you define „*” to be a mapping from ( %, % ) to  
Integer. However, % is not necessarily an Integer. Therefore your „*”  
cannot meet the necessary crieria of the „f” in Ralf's „Commutative”  
category ( which would need a mapping from ( D, D ) to D ... which is ( %,  
% ) -> % in this scope )

Substituting „%” for your „Integer” still does not solve the problem ...   
at least for my compiler.

I guess Aldor needs to be told explicitely that % is a Ring. For example,

MyCommutativeRing: Category == with {
   MyRing;
   Commutative(%, *$(% pretend MyRing));
}

works fine for me.

However, Aldor should be able to guess that % is a Ring.

I found that this confusion happens quite often. Aldor fails the recognize  
the proper type of %. Except for „pretend”ing, I have not found a way  
around such issues.

Best regards,
Christian



More information about the Aldor-l mailing list