[Aldor-l] Aldor-combiler bug

Ralf Hemmecke ralf at hemmecke.de
Sun Oct 22 06:51:56 EDT 2006


> %1 >> #include "aldor"
>                                            Comp: 60 msec, Interp: 20 msec
> %2 >> #include "aldorinterp"
>                                            Comp: 30 msec, Interp: 0 msec
> %3 >> import from Integer
>                                            Comp: 10 msec, Interp: 0 msec
> %4 >> Set: Integer := 1
> 1 @ AldorInteger
>                                            Comp: 0 msec, Interp: 100 msec
> %5 >> a: Set Integer
>       ^
> [L4 C1] #1 (Error) `Set' is used in a type, so must be constant, and so cannot be assigned to.
> 
> %6 >> import from Set Integer
>       ^
> [L4 C1] #1 (Error) `Set' is used in a type, so must be constant, and so cannot be assigned to.

Interesting...

Try the following program...
Try for T either MachineInteger, List, String, AldorInteger, Set.

For the first 3 it works.

 >aldor -grun -laldor aaa.as
Set = 1
a   = {1}

for AldorInteger and Set it give the same error as above.

---BEGIN aaa.as
#include "aldor"
#include "aldorio"
macro T == List;
main(): () == {
	import from Integer;
	T: Integer := 1;
	a: Set Integer := [1];
	stdout << "Set = " << T << newline;
	stdout << "a   = " << a   << newline;
}

main();
---END aaa.as

For me that looks like a compiler bug, since if T==>Set then there are 
just two identifiers

Set: Integer
Set: (T:PrimitiveType) -> Join(BoundedFiniteLinearStructureType T,
			DynamicDataStructureType T) with { ... }

visible to the compiler and I cannot understand why it thinks that the 
second "Set" which is a constant function has been redefined or made 
non-constant.

But maybe the rule applies that in a given scope a variable can only 
have one type. Still, we have a variable and a constant in scope. That 
should not be a problem. Or should it? Does somebody know where this is 
explained in the AUG?

BTW, how far is the progress of open sourcing the Aldor compiler?

Thank you
Ralf



More information about the Aldor-l mailing list