Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: RFC: Alter - Perl extension for Alter Ego Objects

by Anno (Deacon)
on Jul 01, 2007 at 21:15 UTC ( [id://624347]=note: print w/replies, xml ) Need Help??


in reply to Re: RFC: Alter - Perl extension for Alter Ego Objects
in thread RFC: Alter - Perl extension for Alter Ego Objects

Thank you. One thing. You said about Alter-based objects

You can tell them to behave like this or that, merely by blessing them into the package which is needed at the time.

Re-blessing isn't really involved in accessing alter egos. It's the package the call to ego() is compiled into that determines the class whose ego is seen. That will normaly be the right one when a class compiles its accessors.

Anno

Replies are listed 'Best First'.
Re^3: RFC: Alter - Perl extension for Alter Ego Objects
by diotalevi (Canon) on Jul 02, 2007 at 14:31 UTC

    It is really common for interesting objects to compile their own accessors. If you require that and break on things compiled in the "wrong" class, much of CPAN is in a world of hurt if applied to your code.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      I don't understand.

      An object from a given class (which doesn't know about alter egos) will continue to access the object body (if that's what it does) with no interference. If an Alter-based class initializes and uses that object, a corona of alter egos will be attached for the Alter-based class(es) to use. The original class will know nothing about that and continue doing what it did all along.

      Where's the problem?

      Anno

      Update: I'm not trying to make old code use the alter technique, that's the next stage :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-16 18:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found