Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Beyond Inside-Out

by Anno (Deacon)
on May 30, 2007 at 19:00 UTC ( #618271=note: print w/replies, xml ) Need Help??


in reply to Re^3: Beyond Inside-Out
in thread Beyond Inside-Out

Alter objects get garbage collection and thread support from Perl, the class has nothing to do with that. Destructors can be freely used for other purposes.

An Alter-object carries all its data with it, ready to dump and able to be restored

I think these are only true if the object reference is a hash/array that stores the references for each class. If so, you give up encapsulation and the ability to do "black box" (aka "foreign") inheritance.
No, that's not so. An Alter object stores its data in a hash that is magically (in the technical sense) attatched to the object (which can be of any type). Magic is unique in that it is inaccessible to normal Perl (except through the interface you want to provide), but is serviced in garbage collection and thread cloning.

Anno

Replies are listed 'Best First'.
Re^5: Beyond Inside-Out
by xdg (Monsignor) on May 30, 2007 at 21:04 UTC
    Alter object stores its data in a hash that is magically (in the technical sense) attatched to the object

    Ah! Now I get it. A magical hash that is attached to any object? Yes, that does sound like what object properties are supposed to be.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://618271]
help
Chatterbox?
[choroba]: I fear there's no other way than patch perl5db.pl

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2018-01-24 10:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (257 votes). Check out past polls.

    Notices?