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

Re: Inheritance: the root of the problem

by xmath (Hermit)
on Aug 04, 2006 at 16:58 UTC ( #565703=note: print w/replies, xml ) Need Help??

in reply to Inheritance: the root of the problem

Inheritance typically accomplishes two things:

1. interface inheritance, saying you support every operation that your super supports. This is probably better accomplished with interfaces, either explicit (like Java) or implicit (does it support these methods? good enough.)

2. implementation inheritance, reusing the parent's implementation of various stuff because the same applies to you. This is can be done via delegation, where you create the parent object, and "merge" some or all of its methods into the "subclass" object you're creating. If there's a need for the parent to call into the child, then appropriate closures should be passed upwards during construction.

Making a nice syntax for all this is probably the biggest challenge :-)

UPDATE: You might also want to look at how the E programming language, which does closure-based OO, handles delegation.

  • Comment on Re: Inheritance: the root of the problem

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://565703]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2018-04-22 00:14 GMT
Find Nodes?
    Voting Booth?