Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
more useful options
 
PerlMonks  

Re^8: Informal Poll: Traits (Long Post Warning!)

by Corion (Patriarch)
on Nov 20, 2005 at 14:07 UTC ( [id://510271]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to The need to rebless (was: Informal Poll: Traits)
in thread Informal Poll: why aren't you using traits?

When you have a generic proxy object like Object::Realize::Later, which more or less implements lazyness for method calls, it is quite convenient to have the object change class after it has been realized. Otherwise, lots of (brain-dead, I admit) checks fail when they ask UNIVERSAL::isa($obj,'foo');. Of course one could circumvent this problem with multiple inheritance or by writing a specialized ::Proxy class for every class to be lazy ...

  • Comment on Re^8: Informal Poll: Traits (Long Post Warning!)

Replies are listed 'Best First'.
Re^9: Informal Poll: Traits (Long Post Warning!)
by chromatic (Archbishop) on Nov 21, 2005 at 03:07 UTC

    Override isa() in your code and tell anyone who calls it as a function that their code breaks yours, 'cuz it does.

Re^9: Informal Poll: Traits (Long Post Warning!)
by dragonchild (Archbishop) on Apr 18, 2006 at 08:21 UTC
    Class::LazyLoad doesn't need to do this. I wonder why you felt that Object::Realize::Later needed to do so.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

      From a look at the documentation, Class::LazyLoad doesn't seem to support classes that implement cheap operations but can become the full fledged object on demand. Which is what Object::Realize::Later does. There are ways around this that don't need reblessing into the full class I guess, like aggregation/creation of a new instance, but reblessing is the easy/safe way. This is discussed in the Traps section of the documentation.

        This is true. C::LL supports non-existence or existence. Apparently, O::R::L supports the intermediate state. Neat!

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://510271]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.