[Aldor-l] non-reflection

Ralf Hemmecke ralf at hemmecke.de
Thu Jul 27 14:49:41 EDT 2006


Hello Bill,

> This same program using a List data structure instead of a
> Generator compiles (almost):

I have shortened your program a bit. So now it is no longer about 
reflections.

--- BEGIN: aaa13.as
#include "aldor"
#include "aldorio"

exports: List Category == [
     with {+:(%, %) -> %},
     with {foo:(%, %) -> %},
     with {-: % -> %}
];

default sig: Category;
for sig in exports repeat {
	cat: Category == sig;
	stdout << (Integer has cat) << newline;
}
---END aaa13.as

That compiles and runs, but the output is not as you would expect given 
the fact that Integer surely as such an addition.

 >aldor -grun -laldor aaa13.as
F
F
F

And it even does not help if you say

    define cat: Category == with sig;

Note however, that I define (and redefine a constant inside the loop 
body. Using == inside loop bodies has once been told to me by an Aldor 
developer from NAG, but I am not sure that I understand what the scope 
of cat is.

You can add a line

stdout << (SingleFloat has cat) << newline;

after the for loop. And this gives just another F as output.

Ralf




More information about the Aldor-l mailing list