Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^9: In need of a Dumper that has no pretentions to being anything else.

by demerphq (Chancellor)
on Feb 24, 2005 at 07:54 UTC ( [id://433976]=note: print w/replies, xml ) Need Help??


in reply to Re^8: In need of a Dumper that has no pretentions to being anything else.
in thread In need of a Dumper that has no pretentions to being anything else.

Yes weakrefs() are one thing that causes DDS a lot of problems, they completely screw DDS and there really is nothing I can do about it.

As for the advice that weakrefs are the correct way to do self referential structures, I disagree. There really is no reason to require weakrefs and in fact IMO when you design self referential structures without using weakrefs you get certain benefits that are available when you do not use weakrefs.

The central idea is that you use a stub object that isnt part of the self referential structure as the root or container of the structure. Since the root is not part of the reference cycle its refcount will decrement properly when it falls out of use, which will then trigger the DESTROY{} method which will then traverse the structure and eliminate the reference cycles. This is a useful design anyway as you can now use the root for various bookeeping efforts like how many nodes their are, different entry points into traversing the structure, even state information for things like iterators. All of these latter things are impossible or very difficult to accomplish with a "no container class using weakrefs" type data structure.

---
demerphq

  • Comment on Re^9: In need of a Dumper that has no pretentions to being anything else.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found