Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Doubt about fly-weight objects.

by sh1tn (Priest)
on May 17, 2005 at 09:39 UTC ( [id://457718]=note: print w/replies, xml ) Need Help??


in reply to Doubt about fly-weight objects.

Another (if not the same) good link Design Patterns in Perl.


Replies are listed 'Best First'.
Re^2: Doubt about fly-weight objects.
by blazar (Canon) on May 17, 2005 at 13:59 UTC
    An extremely good link indeed!

    Actually the code examples given there support (IMHO) what I wrote in Re^2: Doubt about fly-weight objects., i.e. that the aspect that is mostly stressed is that of caching. But then again, it wasn't much touched upon in all of the previous examples of flyweight objects I had seen.

    This actually raises in me a related question: if it's only for caching, can't one still obtain it with a lexical hash with "standard" objects? I mean, something a' la:

    { my %seen; sub new { my $class = shift; my ($this, $value)=@_; my $id = unique_id $this, $value; $seen{$id} ||= bless { THIS => $this, VALUE => $value }, $class; } # Suitable DERSTROY here... }
    In other words, the two concepts, i.e. that of caching and that of storing the actual object's data in package lexical "outside" of the object itself are mostly orthogonal. Aren't they?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://457718]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found