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

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Decide how you want inheritance to work, and you can implement it with closures. It won't even take much work. Since closures and OO programming are pretty much orthogonal concepts, there isn't really a natural closure way to do OO. They are pretty unrelated concepts. I like to say it as, "OO is about creating good nouns and closures are about creating good verbs." They are just different ways of thinking about the problem.

The first time I tried to implement an object model with closures was at Re (tilly) 1: Nested Classes. As you can see, it is quite simple. (However I picked a simple model to implement.) At A Cat's eye view of OO you'll find an explanation of that particular inheritance model. If you want some more ideas, there is no shortage of places to look. The Perl 6 design notes, the object models of other languages, CLOS, and so on.

What do YOU want an object model to do for you?


In reply to Re: Inheritance: the root of the problem by tilly
in thread Inheritance: the root of the problem by apotheon

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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 the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (10)
    As of 2014-04-21 16:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (496 votes), past polls