|Questions about anonymous functions and classes/functions declarations firstname.lastname@example.org (Gabriele Farina) (2003-10-04)|
|Re: Questions about anonymous functions and classes/functions declar email@example.com (Daniel Yokomiso) (2003-10-06)|
|Re: Questions about anonymous functions and classes/functions declarat derkgwen@HotPOP.com (Derk Gwen) (2003-10-06)|
|Re: Questions about anonymous functions and classes/functions declarat firstname.lastname@example.org (Louis Paul Santillan) (2003-10-06)|
|Re: Questions about anonymous functions and classes/functions declarat email@example.com (2003-10-06)|
|Re: Questions about anonymous functions and classes/functions declarat firstname.lastname@example.org (Joachim Durchholz) (2003-10-06)|
|Re: Questions about anonymous functions and classes/functions declarat email@example.com (Geoff Wozniak) (2003-10-08)|
|[3 later articles]|
|From:||"Gabriele Farina" <firstname.lastname@example.org>|
|Date:||4 Oct 2003 14:35:41 -0400|
|Posted-Date:||04 Oct 2003 14:35:41 EDT|
I'm planning to try to implemente a programming language. I got a lot
of ideas, and I know how to implements them except for anonymous
functions. Where I have to store them?? I have to have a table only
for anonymous functions?? Someone asks to me to treat them as
constants, but I can't understanda how to develop it.
Now there is another questions: I'd like to give the users the ability
to edit a class definition at runtime. For example:
test = class()
if value == 10
test.a_new_method = function(a) print a
test.a_new_method = function(a) print 'Your wrong the number, you
instance = new test()
This little piece of code is useless, I know, but I write it to make you
understand what I'd like to do.
test = class() defines a new class, where, dynamically, I add a new method
looking at a variable value given as input.
As you can see I add new method at runtime.
Do you think this can be useful and can be implemented?? There could be any
thanks a lot, I hope you understand my questions.
[The only way I know to handle anonymous functions is to give each on a
secret private name at compile time. As far as adding new methods at
runtime, it's doable but it means that you have to keep most of the
compiler symbol table at runtime and possibly the whole compiler if
you're adding new code on the fly. -John]
Return to the
Search the comp.compilers archives again.