[Aldor-l] [Axiom-developer] Re: exports and constants

Ralf Hemmecke ralf at hemmecke.de
Thu Jul 27 11:25:44 EDT 2006


>> #include "aldor"
>> #include "aldorio"
>> import from Reflection;
>> l: List String := exports(PrimitiveType);
>> stdout << l << newline;
>>
>> just prints something like
>>
>> list(=, ~=);
>>
> 
> This example is a good one but I object to the use of
> String as a representation for the output of Reflection
> operators.

Of course. But if you want to print out thinks you must be able to 
convert to something that you can put onto a screen. It was just a 
simple example, after all.

> In Aldor we can do much better than that. A
> function like export should probably look something like
> this:

>   exports: Domain -> Generator Category
> 
> Yesterday I gave this example:
> 
> -----------
> MyDom: with
>   exports:Generator Category
>   add2:(MyDom,MyDom) -> MyDom
>   sub2:(MyDom,MyDom) -> MyDom
>   neg: MyDom -> MyDom
>  == add
>   import from Integer
>   Rep == Integer
> 
>   exports:Generator Category == generate
>     yield with {add2:(MyDom,MyDom)->MyDom}
>     yield with {sub2:(MyDom,MyDom)->MyDom}
>     yield with {neg:MyDom->MyDom}
> 
>   add2(x:%,y:%):% == per(rep(x) + rep(y))
>   sub2(x:%,y:%):% == per(rep(x) - rep(y))
>   neg(x:%):% == per(-rep(x))

I liked your code, but in fact that does not use reflection at all and
I think it should even compile. You are not doing anything fancy.

BUT, in the "add" you list the exports explicitly. Note that it would be 
better if you just say

for s in exports(Mydomain) repeat ...

where exports would have type

   Type -> Generator Category

and would be implemented in a runtime support library.

Ralf



More information about the Aldor-l mailing list