Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
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).
JSAN modules implement inheritance (Score:1)
Take a look through some of the JSAN stuff. There was a bunch of work that got done on implementing what I believe we were calling pseudo-classes.
http://openjsan.org/doc/r/rk/rkinyon/Class/0.05/lib/Class.html [openjsan.org]
http://openjsan.org/doc/l/ly/lyokato/Class/Setup/0.04/lib/Class/Setup.html [openjsan.org]
http://openjsan.org/doc/i/in/ingy/Subclass/0.10/lib/Subclass.html [openjsan.org]
Self and NewtonScript (Score:1)
If memory serves, Self had a system to make any slot a parent-slot - by convention "parent*" was the object cloned from, but any slot could be a parent-slot by adding a * to the name. How dispatch was eventually (mis-)handled, I have no recollection...
NewtonScript was based on Self, but extended the convention to always have two parent-slots for gui-elements (business-object + gui-object), but not any more, as I recall.
And speaking of prototype-based language, why would anyone add first-order functions
Re: (Score:1)
Huh? JavaScript has closures. They work perfectly well. I've been using them for years.
But there is a major gotcha. Variables declared with var are always scoped to the nearest function call. So if you create closures in a loop, they will all point to the same variable. However once you know that's the issue, that's easily fixed - just call a function from within the loop whose job is to scope the variable correctly.
Re: (Score:1)
I always thought of Prototype OO ... (Score:1)
as "Every Class is a Singleton and is Instantiated", which glosses over a bunch of stuff but does roughly fit the way things like Joose [google.com] are dealing with JS's Prototype OO.
A paper and a post (Score:1)
Also Steve Yegge's Universal Design Pattern [blogspot.com] (aka Propertise Pattern) covers the topic quite thoroughly.
broquaint out
Re: (Score:2)
Nope, not old news at all. Thanks for the tip!