axiom-developer
[Top][All Lists]
Advanced

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

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


From: Page, Bill
Subject: RE: [Aldor-l] [Axiom-developer] Re: exports and constants
Date: Thu, 27 Jul 2006 10:05:10 -0400

On Thursday, July 27, 2006 9:10 AM Ralf Hemmecke wrote:
> Tim Daly wrote: 
> > I might mention that the lisp output would be significantly
> > easier to parse and maintain.
> 
> Are you saying that aldor should not be translated to C or
> Fortran or whatever other target there will be in the future?
> 
> I have no access to the LISP output at runtime of my program.
> 

I think Tim is fixated on Lisp. I do not see any relevance
of Lisp to the subject of reflection in Aldor.

> > Language manipulation and transformation is the easiest
> > thing to do in lisp (due to the fact that data and
> > program have the same syntax). Lisp's READ function is 
> > straightforward. You could cover the reader with a complete
> > Aldor package that could extract any known piece of
> > information on request (e.g. fetchSignatures). Thus
> > creating a complete reflection API only involves knowing
> > the structure of the data in the output file.

One would not need to resort to such low-level tactics
if reflection was designed into Adlor at the proper level.

> 
> So what does that mean? If I want to use reflection for 
> domains defined in libaldor. I would expect that
> 
> #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. 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))

----------

Use like this:

  for s in exports$MyDom repeat
    if MyDom2 has s then
      ...
      etc

> How do you think that program would be compiled if there
> is some lisp stuff involved? Note that this is a standalone
> program.
> 

Lisp is irrelevant to this. For that matter as Christian
Aistleitner pointed out in a recent email, so are the
actual internal details of Aldor such as FOAM, the contents
of the .asy and .ao files.

Regards,
Bill Page.




reply via email to

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