axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] RE: Types as values, and Re: Static versus Dynamic


From: William Sit
Subject: Re: [Axiom-developer] RE: Types as values, and Re: Static versus Dynamically typed(was:Philosophy... )
Date: Sat, 24 Sep 2005 12:07:20 -0400

Bill Page wrote:
> 
> On September 23, 2005 7:36 AM William Sit wrote:
> > From www.aldor.org:
> > > Types and functions are first class entities allowing them to be
> > > constructed and manipulated within Aldor programs just like any
> > > other value.
> > >
> > Can some Aldor expert expand on this? For example, can functions be
> > created, modified, and compiled and called all at run time? (People
> > used to do code modification on assembly languages and may still do,
> > but the practice is I think no longer promoted, if not outright banned.)
> >
> 
> People certainly still do this, for example in lisp, Python and
> Haskell.

Sure, hackers and virus authors, too. But I am asking the question on an algebra
code level. 
 
> I can't speak about Aldor specifically (yet) but I am sure that
> it is possible.

Examples?

> In Axiom it is possible. See for example section 9.50 MakeFunction
> in the Axiom book. There are numerous other examples of this in
> Axiom.
> 
Thanks, but MakeFunction only turns an expression into a function by enabling
evaluation. So in this sense, sure a new function is created, much like defining
a new function in the interpreter. What I meant (sorry I wasn't clear) was to
take an existing library function, say a simple one like "inc" which adds 1 to
the argument, modify the code and create FROM THAT CODE a new function "incBy2"
(or for that matter, use the same function name "inc") that adds 2 to its
argument (note, not rewriting from scratch "incBy2", and not implementing
"incBy2" USING "inc" twice, but by modifying existing code, changing where "1"
is, to "2" in the code itself), have that function compiled, and executed, all
without leaving the interpreter or Axiom (or, Aldor). The crucial thing I am
asking is "code-modification" because that is the real meaning, as I understand
it, of "constructed and manipulated [Types and functions] ... just like any
other value".  Similarly, the "curry" type functions in Axiom do not "modify"
code and is a variant of MakeFunction. Can Aldor manipulate types and functions
much like Lisp (or Scheme) does? In principle, this is easy, if the code is
treated as a string, and if the format structure and language syntax are known;
so the question is not whether this is "possible", but whether this is
"available" as a feature of the Aldor language, that the code string can be
returned, manipulated, edited, and sent back to the compiler to get a new or
modified function. In Axiom, I would imagine one has to go the relevant NRLIB,
look at the code.lsp, and create a new version of it, create the corresponding
.o file to make this "possible". I don't consider that as "available".

Thanks, Bill, for your input. (I see you are experimenting with Types as
values).

William




reply via email to

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