[Aldor-l] define keyword

Christian Aistleitner tmgisi at gmx.at
Mon May 23 02:28:37 EDT 2005


Hello Manuel,

> There is a difference: in the aldor form   Name:T == V
> only the type 'T' of 'Name' is visible when you import Name in scope.

As I wrote in the original mail, this is exactly what the user guide is  
saying, but my experience is different.

However, I could not find a place within all my code, where the value is  
not seen (athough I never use a define). Therefore I thought, the User  
Guide might be outdated in one further part.

Is there some code snippet, where the difference becomes visible, as I  
cannot find one.
Look for example at the folloming piece of code:

-------------------------------
#include "aldor"

CatA: Category == with {
     funcA: Integer -> Integer;
}

DomA: CatA == add {
     funcA( a: Integer ): Integer == {	
	a + 1
     }
}

import from DomA;

funcA( 1$Integer );
-------------------------------

If I understood you correctly, you would not expect this code to compile  
(as two defines are missing and funcA cannot be resolved). However the  
code compiles.

I created four versions of the upper code:
One without defines (as seen above),
one with only the first define,
one with only the second define, and
one with both defines.

I compiled and compared these versions.
The .fm, .ao and .o files are exactly the same four all versions!

So, I cannot see a difference.

Then I put the definition of CatA and DomA in separate files in a library  
and called the library's DomA's funcA from outside of the library. Again,  
I produced four different versions as shown above. Still no change. Again,  
all .fm, .ao, and .o files (of the libraries source code and the calling  
source code) are equal.

Again, I cannot see a difference between using and omitting the defines.

> For example: MyInteger:Ring == add { ... }
> when you 'import from MyInteger', only its type 'Ring' is known in scope,
> not the details of the rhs (the add part).

I agree, but adding a define, does not change anything. Otherwise, the  
funcB (in the following piece of code) should be visible. However, the  
compiler cannot find an appropriate funcB.

-------------------------------
#include "aldor"

define CatA: Category == with {
     funcA: Integer -> Integer;
}

define DomA: CatA == add {
     funcA( a: Integer ): Integer == {	
	a + 1
     }
     funcB( a: Integer ): Integer == {	
	a + 1
     }
}

import from DomA;

funcB( 1$Integer );
-------------------------------

Best regards,
Christian



More information about the Aldor-l mailing list