Meanwhile, you say none of that is necessary on private data anyway.
But, the representation of the class is opaque. I can't get at the slot without going through the MOP or inline functions generated by the MOP.
Does the average class need to have complete freedom to separate instantiation representation from the class? That's akin to the 'tie' feature in classic Perl 5, and agree that this is better served using abstract interfaces. I won't be changing the "bits" suddenly to a different implementation. Hmm, or will I? In Perl 5.xx+ maybe an efficient XS-based slot mechanism will be added to some platforms, and my existing classes and most of CPAN and all the Catalyst stuff should just work and suddenly work faster! So, maybe I want to keep my options open just now.
Now roles on the other hand can be added to any kind of class, and can't assume the storage layer in use by whatever class it winds up in. So it should be more abstract, unless it's app-specific and knows something about where it's going.
So, maybe you and I would both like a lvalue option. Declare my private instance data with some keyword or something that makes it generate an lvalue accessor for combined get/set usage, with no init-arg, type check, etc.
Another idea would be a Moose implementation layer that guaranteed a certain naming convention among its use of hash keys, and was known to be a blessed hash. Then you could add your own instance data among the $self->{keys} in the classic manner. You would define that you wanted that implementation metaclass (whatever it's properly called in Moose) when you created that class.
In reply to Re^2: Some thoughts on Moose Attributes
by John M. Dlugosz
in thread Some thoughts on Moose Attributes
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |