|Just another Perl shrine|
I've studiously avoided the term "flyweight objects" as I have only ever seen it here and didn't really understand its meaning. I'll stick to "Inside-out" which only has meaning in perl terms as far as I am aware.
Which would be annoying. One of the main advantages of the design pattern movement for me is the development of a common vocabularly (finally, everybody knows what a singleton is :-). If it means something different in the perl world it would be useful to know.
With regard to the example you describe, that may have made some sense in the world of 8-bit chars as you only need a pool of 256 object, but in the world of UCS, it becomes excessive I think...
I don't really want to repeat everything in the chapter from the book, but basically...
As for practicality, the example was in the book was adapted from the Doc editor, produced using InterViews 3.0. Take a look at:
To quote from the Design Patterns chapter on flyweights:
Doc uses glyph objects to represent each character in the document. The editor builds one Glyph instance for each character in a particular style (which defines its graphical attributes); hence a character's intrinsic state consists of the character code and its style information (an index into a style table). This means only position is extrinsic making Doc fast.
If you're interested in the details I'd recommend picking up a copy of Design Patterns and giving the flyweight chapter a read.
In reply to Re^2: Flyweights - different meaning in perl?