in reply to Functional Inside Out Closure Objects
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:# create method my $eval = "sub $class\:\:$name { goto \$hash{\$_[0]}}\n"; eval $eval;
The result should be the same, but no goto.*{"${class}::$name"} = $ref;
-stvn
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Functional Inside Out Closure Objects
by fletcher_the_dog (Friar) on May 20, 2004 at 16:25 UTC | |
by stvn (Monsignor) on May 20, 2004 at 16:57 UTC | |
Re: Re: Functional Inside Out Closure Objects
by sth (Priest) on May 20, 2004 at 17:19 UTC | |
by stvn (Monsignor) on May 20, 2004 at 17:52 UTC | |
by jdporter (Paladin) on May 20, 2004 at 18:44 UTC | |
by stvn (Monsignor) on May 20, 2004 at 19:36 UTC | |
by jdporter (Paladin) on May 20, 2004 at 20:12 UTC | |
|
In Section
Seekers of Perl Wisdom