Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

comment on

( #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)


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

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2022-09-25 01:03 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (116 votes). Check out past polls.