Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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)

-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":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (5)
    As of 2018-02-20 08:39 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      When it is dark outside I am happiest to see ...














      Results (268 votes). Check out past polls.

      Notices?