Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Inheritance: the root of the problem

by tilly (Archbishop)
on Aug 04, 2006 at 04:10 UTC ( #565609=note: print w/ replies, xml ) Need Help??


in reply to Inheritance: the root of the problem

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?


Comment on Re: Inheritance: the root of the problem
Re^2: Inheritance: the root of the problem
by apotheon (Deacon) on Aug 04, 2006 at 07:52 UTC

    Decide how you want inheritance to work, and you can implement it with closures.
    That's just it — I don't know yet, and it's the question I seek to answer by way of this discussion (or, at least, a question I seek to get closer to answering by way of this discussion). There are many here at PerlMonks who know great gobs more about OOP and inheritance-like mechanisms than I, and I seek their (your) wisdom.

    print substr("Just another Perl hacker", 0, -2);
    - apotheon
    CopyWrite Chad Perrin

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://565609]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2014-10-20 12:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (76 votes), past polls