http://qs1969.pair.com?node_id=524339


in reply to Re: Slides from NY Inside-Out Talk
in thread Slides from NY Inside-Out Talk

I drew a distinction between "inside-out" (lexicals for each property) and "flyweight" (single lexical holding hashrefs for each object). That may be arbitrary, but I think it's significant as inside-out, defined that way, makes property names into lexical identifiers that can be checked with strict, unlike hash keys:

# regular object $self->{name} = "Larry"; # name is a hash key # flyweight object, as per Damian's book my @objects; $objects->[$$self]->{name} = "Moe"; # name is a hash key # inside-out object my %name; $name{ refaddr $self } = "Curly"; # name is a lexical variable

I don't have TheDamian's Object-Oriented Perl handy at the moment, but I don't recall that it went beyond the flyweight idea. Abigail-II's talk on Lexical::Attributes was the first I'd seen of it, and I hadn't come across any prior art before Re: Where/When is OO useful?.

I certainly believe that Abigail was building upon Damian's foundation -- a point that I made verbally in the talk on p.9, which shows the evolution from class properties to the flyweight pattern as a setup for explaining the inside-out pattern.

I included Damian's book in the reference as valuable background material in general, as this was an introductory talk and I did cover the flyweight pattern, albeit briefly.

If I have overlooked some prior art there or elsewhere, I welcome a specific correction and citation and would be happy to include it in the talk.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.