Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

*mumble grumble mumble*
I searched CPAN for hours and didn't find that!

After quickly looking at it, it looks like Object::Realize::Later impliments the same sort of thing, but goes about it in a very different way, and with a different philosophy.

Class::LazyObject is all about invisiblity. An assumption I made in Class::LazyObject is that the Lazy Object could be used invisibly in the place of an inflated object, meaning it could be easily grafted on to a program even after the program had been designed. Object::Realize::Later seems to require you to have planned to use it, restricting which method names you can use in your inflated objects. (It looks like it pollutes its lazy objects' namespaces with methods named "becomes", "believe_caller", "realize", "source_module", "warn_realization", "forceRealize", "willRealize" and "warn_realize_again ", this could be problematic if the inflated class uses methods with these names.)

An even greater major difference is in how copies of lazy objects are handled. (Since objects are really just refs, after $object2 = $object1, both variables refer to the same object, and any changes to $object1 will be reflected in $object2). This means that, after $lazy_object2 = $lazy_object1, if $lazy_object1 is inflated, $lazy_object2 should be a reference to the inflated object. While Object::Realize::Later leaves the user to worry about how to go about implimenting this (thought it does give suggestions in the documenation), Class::LazyObject specifically handles this for the user, ensuring that the correct behavior always occurrs. Additionally, it does this without reblessing the lazy object.

Another thing that O::R::L doesn't appear to be able to do is handle AUTOLOADed methods in the inflated class. Class::LazyObject can handle them.

Additionally, O::R::L doesn't appear to have support for overloaded operators on lazy objects. I am already working on automatic operator overloading of lazy objects, which should be in a future release.

While it will be worth contacting the author of Object::Realize::Later, it seems like our two modules are headed in slightly different paths. I can think of several instances in which Class::LazyObject would fit but Object::Realize::Later would not. I still think Class::LazyObject warrants its own place on CPAN.

Thank you for finding Object::Realize::Later, though.

Edit:Added more information.


Once it's Turing complete, everything else is just syntactic sugar.

In reply to Re: Re: RFC - Class::LazyObject by QwertyD
in thread RFC - Class::LazyObject by QwertyD

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-03-29 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found