Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Friday May 22, 2009
08:46 AM

Prototype OO and Multiple Inheritance?

[ #39021 ]

I'm thinking about the my Roles talk at YAPC::EU::2009, (you know the conference, right? The one I made that strange little promo for?). It's a bit of a tutorial, but not much. It's more about the "why" instead of the "how" because even though I get plenty of comments/emails about roles, they're almost always in the "why" category. That's because roles are so easy to use once you start that you really need motivation for starting rather than a guide on how to start (though I'll give some of that, too).

One thing I am doing is a bit of comparing/contrasting with multiple languages and how they all struggle to figure out how to manage inheritance. Everyone seems to have a different idea, but I'm stumped on Javascript and other prototyped OO languages.

Prototyped OO languages don't have classes. Thus, you really can't inherit. However, you use an existing object as a "prototype", clone it, and then add state/behaviors as needed. So one might think there's a loose analogy to inheritance there. What I'm wondering is whether or not this enforces a tree-like hierarchy on object systems? Is there any analogue to multiple inheritance? If not, how is this worked around. Every language I've ever used which forbids MI has a workaround (interfaces, mixins or the weird stuff that BETA does). Any other comments about prototype OO languages welcome (particularly if you have experience with examples other than JavaScript).

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.