|We don't bite newbies here... much|
Re: Functional Inside Out Closure Objectsby stvn (Monsignor)
|on May 20, 2004 at 16:19 UTC||Need Help??|
I, like many people (See the number of Class::* modules on CPAN), have sought to make oop easier in perl.
Personally, I never really thought of OOPerl as hard, ugly yes, primative maybe, clobbered on, for sure, but not really all that hard. :P
It is my understanding that when closures are used that the different version of a closure share the same code but just use a different set of lexicals. So I think that the overhead for an individual object should just be the set of lexicals plus the references to the CODE objects. Is this a correct understanding of how closures work?
This is pretty much my understand of closures as well. Although I cannot say for sure that it is correct :)
My second question about overhead is the use of the "goto" in the methods
You could likely get rid of the goto if you wanted to. Instead of evaling your code like this:
You could just do some symbol table mangling like this:
The result should be the same, but no goto.