[Aldor-l] local vs. non-local

Ralf Hemmecke ralf at hemmecke.de
Mon Feb 26 12:25:41 EST 2007


Up to now I thought the "local" keyword just keeps something local. But 
now I stumpled over the following program which does only compile if I 
remove the "local" in front of new although both "new" functions come 
from different domains.

Perhaps I could understand that the compiler complains about two "new" 
functions inside DomB where one of them is local and the other is not. 
But even then it would be strange to think that there is a good reason 
why the compiler should forbid something like

baz(i: Integer): % == ...
local baz(): % == ...

because the two functions have different types.
Does there anybody know what happens here? Is this a compiler bug?

If this is not a compiler bug then the documentation in Chapter 8.13. of 
  the AUG should more clearly state that the type in a "local" 
declaration is irrelevant.

Ralf

---------------------------------------------------------
 >aldor aaa.as
"aaa.as", line 13:         local foo: DomA == new() $ DomA;
                    ...........................^
[L13 C28] #2 (Note 1)  (cf. L14 C15)

"aaa.as", line 14:         local new(x: Integer): % == per x;
                    ..............^
[L14 C15] #1 (Error) It is illegal to declare an identifier free or 
local once it has already been used, defined or assigned.
(see Note 1)

---BEGIN aaa.as
#include "aldor"

DomA: with {
	new: () -> %
} == add {
	Rep == Record(abc: Integer);
	import from Rep;
	new(): % == per [0];
}

DomB: with == add {
	Rep == Integer;
	local foo: DomA == new() $ DomA;
	local new(x: Integer): % == per x;
}
---END aaa.as



More information about the Aldor-l mailing list