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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Inheritance: the root of the problem
by apotheon (Deacon) on Aug 04, 2006 at 07:52 UTC |
In Section
Meditations