[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Ralf Hemmecke
Subject: Re: [Aldor-l] [Axiom-developer] Re: exports and constants
Date: Thu, 27 Jul 2006 17:25:44 +0200
User-agent: Thunderbird (X11/20060516)

#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

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

  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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]