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

blazar has asked for the wisdom of the Perl Monks concerning the following question:

As some of you may have understood by some posts of mine I'm pursuing some interest in object orientation in Perl...

Now, I've read a few documents about fly-weight and inside-out objects, and while I understand perfectly

  1. which is the problem that the latter ones try to cope with, and why they succeed in doing so,
  2. that the latter ones are a generalization (or a special case?) of the former ones,
I don't see which is the actual advantage of fly-weight objects over "standard" ones, apart some moderate amount of conceptual cleanliness. Or is there something obvious that I'm missing?

Question #2

Also, I'm very curious as to know wether someone has ever met any situation in which it has been useful or sensible to have part of the data "inside" the object and part of it stored in a package lexical: possibly by still using the object's blessed reference as in index into a hash, or by some other technique...

Perhaps, thinking of a reblessed object, as suggested to me in Re: Instance data inheritance?, such a technique may be used to include additional attributes to the child object without having to fiddle with the parent one's internals...