in reply to Re^5: Some thoughts on Moose Attributes
in thread Some thoughts on Moose Attributes
I agree it's unlikely.
'nuff said.
Who said anything about a method call?
In the context of "Decoupling representation from behavior at the class or metaclass layer " I don't see how a faster direct access mechanism achieves that "decoupling". But I'll accept that I may have misunderstood you.
What I have in mind is something as fast as a lexical lookup, which as an indexed lookup (and, of course, modulo pad depth and optimization) is (often) quicker than a hash lookup.
I once went quite a long way in developing a closure-based object mechanism. By instantiating a full set of closures for every object instance--kind of JS prototypical I think?--you do get direct lexical access to instance variables. With the obvious downsides.
Maybe a new storage specifier somewhat like, but essentially opposite to state (perhaps 'volatile' or less C-like, 'instance'), could be added to perl 5 that would essentially create a new stash (duplicated from the package stash) could come into being for each new instance? Just a random thought that crossed my conciousness.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Some thoughts on Moose Attributes
by chromatic (Archbishop) on May 02, 2011 at 03:35 UTC | |
by BrowserUk (Patriarch) on May 02, 2011 at 13:03 UTC | |
by chromatic (Archbishop) on May 02, 2011 at 18:03 UTC |