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:22:08 -0400

On Thursday, July 27, 2006 9:51 AM Tim Daly wrote:
> 
> Reflection involves inspecting the internal details of a
> program. A reflection domain would be able to look into other
> domains for details. A reflection domain would export a set
> of methods like fetchSignatures.
> 
> So how would REFLECT get this information? ...

Well obviously the compiler has this information when it
compiles the program but it throws most of it away after the
compile is done. Since in Aldor types are first order objects
it is not necessary for the compiler to do this. All of the
data generated during the compile could in principle be
present and available as constants to the routine itself
and to other functions.

When I wrote:

-----------
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}

...

the constant 'exports' contains a representation of this
routine's actual exports (minus the 'exports' constant it
self since that would lead to infinite recursion). As Aldor
exists right now - and apparently explicitly by the intention
of the language designers as implied in section 7.1 of the
Aldor Users Guide - it is necessary to add the "reflection"
information manually to the code. But of course the compiler
could very easily automatically generate these reflective
type constants.

One very simple thing that one could do without modifying the
Aldor compiler itself would be to use a simple source text
preprocessor to modify the Aldor source code a little before
compilation to insert this extra reflection information.

Regards,
Bill Page.




reply via email to

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