Stefs roadmap for 3.9, time to get it nailed down

Avi Bryant avi.bryant at gmail.com
Sat Feb 26 17:57:14 UTC 2005


On Sat, 26 Feb 2005 06:10:23 -0800, Ned Konz <ned at squeakland.org> wrote:

> Ruby has a single-inheritance scheme much like Smalltalk's, but also adds
> 'modules' which work almost exactly like including a text file that can hold
> more behavioral definitions. Of course, since Ruby doesn't require you to
> pre-declare instance variables, this also lets you have mixins that add
> instance variables as necessary (though there is no attempt at dealing with
> or even detecting name conflicts). Modules actually are nicer than text
> inclusion, as they are first class objects and so support reflection (I
> forget whether they provide a separate namespace).

They do - in fact, the idomatic way to define a namespace in Ruby is
to create a module, and you import that namespace by mixing the module
in to wherever you want to use it.  I would describe the mixin
semantics as being more like a superclass insertion than like textual
inclusion - and, in fact, I'm pretty sure that's how it's implemented.
 That is, if you have class C subclassed from class B, and you include
module M, you end up with single-inheritance lookup along the chain
C->M->B.  If anyone wants to play with an implementation of these
semantics, try my Mixins package on SqueakSource (I don't think it
ever made it to SqueakMap).

Avi



More information about the Squeak-dev mailing list