Minor correction: object state serialization works for any blessed type in Perl, not just references to hashes.
For what part of
for instance, that objects are implemented using a reference to a hash, and that the entire state of the object depends only on the content of said hash (or reference to an array, or scalar).
is that a minor correction?
But state serialization is, as the name implies, writing the state of the object, not the state of the package which manages the object.
An object in Perl is nothing more (and nothing less) than a blessed reference. Fly-weigth and inside-out objects are just that, blessed references. But in general, when people want to "serialize" an object, they want more than the reference, and the package it was blessed into. They also want whatever is used to keep the state of that object.
If you want to implement a new object model on top of the one Perl has got already, including flyweight or inside-out,
Fly-weight and inside-out objects don't implement a "new moduel on top of the one Perl has got already". What Perl has is bless REFERENCE, PACKAGE
. Traditional hash based, fly-weight and inside-out objects use blessed references. Where fly-weight and inside-out differ from traditional objects is that traditional objects use the memory the reference is pointing to store their state, while fly-weight and inside-out use the reference as an index. But neither solution is any more or less "native" to Perl, as the language support for objects stops after bless
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||