note
stvn
<BLOCKQUOTE><I>
I, like many people (See the number of Class::* modules on CPAN), have sought to make oop easier in perl.
</I></BLOCKQUOTE>
<P>
Personally, I never really thought of OOPerl as <I>hard</I>, ugly yes, primative maybe, clobbered on, for sure, but not really all that hard. :P
</P>
<BLOCKQUOTE><I>
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?
</I></BLOCKQUOTE>
<P>
This is pretty much my understand of closures as well. Although I cannot say for sure that it is correct :)
</P>
<BLOCKQUOTE><I>
My second question about overhead is the use of the "goto" in the methods
</I></BLOCKQUOTE>
<P>
You could likely get rid of the goto if you wanted to. Instead of evaling your code like this:
<CODE>
# create method
my $eval = "sub $class\:\:$name { goto \$hash{\$_[0]}}\n";
eval $eval;
</CODE>
You could just do some symbol table mangling like this:
<CODE>
*{"${class}::$name"} = $ref;
</CODE>
The result should be the same, but no goto.
</P>
<P>
</P>
<div class="pmsig">
<div class="pmsig-315586">
-stvn
</div>
</div>
354972
354972