Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

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

Inheritance works very well, for some definitions of "well". The inside-out design is generally very orthogonal -- meaning that it doesn't collide data with superclasses. You can use Object::Local to subclass pretty much any other class, even classes based on some other system -- all it cares about is that the superclass constructor gives back a reference.

The tricky bit is in the accessors, though. If you define properties with the same name as a superclass, you have to be careful what you wind up with for accessors. By default, Object::Local uses private properties -- no accessors are created as you access the properties directly via the local aliases. (This is sort of the major goal -- strict-safe properties without accessor calls, though you can request accessors, too.) But in that case if the superclass has an accessor with that name, you have to be careful not to call it by mistake when you don't mean to.

It does not really support multiple inheritance, though, as that generally requires too much coordination within/between object frameworks for setup/teardown. The Object::Local approach treats the superclass as a black-box -- it lets the superclass build a new object, then does its own additional initialization. On destruction, it does its own teardown then has the superclass do its teardown. The design goal is maximum orthogonality.

If you're really jonesing for a sneak-peak, you can pull from my subversion server. It's a moving target, of course, so some revisions may be buggy, but I usually try not to check in unless all tests are passing. (Occasionally I have to if I'm moving back and forth from the laptop.) Documentation is very sparse so far, so the best way of seeing how it works is to look at the 't/' directory, where the 'Objects' directory contains many simple examples used in testing. I hope to have a release to CPAN by the end of the week -- at this point it's mostly an issue of documentation. The API should change minimally.

(Edited to change repository target to renamed "Object-LocalVars" directory)

-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.


In reply to Re^2: RFC: an unusual inside-out object generator by xdg
in thread RFC: an unusual inside-out object generator by xdg

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 sharing their wisdom with the Monastery: (3)
As of 2024-04-20 15:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found