On Nov 16, 2007 2:51 PM, David A. Black <dblack / rubypal.com> wrote:
> Hi --
>
>
> On Sat, 17 Nov 2007, Greg Weeks wrote:

> > As for "Meta": I don't know if the English language is precise on this
> > point.  As I understand it, a meta-foo is a foo *about* foos.  A
> > meta-class is a class with class instances, I would think.  Although
> > most Ruby meta-classes are virtual, we can still mix modules into them,
> > so they provide a powerful mechanism for meta-programming.  That's why
> > I'm inclined to call them (limited) meta-classes.
>
> I believe Jim Weirich once said that the only real metaclass in Ruby
> is Class, since it's the source of class instances.

In Smalltalk, where this stuff isn't so hidden. a metaclass is a class
of a class.

The main layout of classes and singleton classes as a parallel
hierarchy with a cross-over and a loop at the top in Ruby is
remarkably similar to that of Smalltalk.  Of course Smalltalk also
doesn't interpose module proxies as class-like things marked to be
special, since it doesn't have modules.

On the other hand Ruby doesn't have a Metaclass class like Smalltalk
does. Smalltalk metaclasses have behavior mostly for interacting with
the IDE.  Sometimes I wish that Matz had put in a Metaclass class just
so things wouldn't be so damned mysterious.

IIRC the quote from Matz in the Pickaxe was that these things we are
talking about "act just like" Smalltalk Metaclasses, but they aren't
metaclasses, they are singleton classes of classes.  I don't know if
it's how Matz intended it, but I can interpret it as meaning that they
aren't metaclasses just because there isn't a Metaclass class.  In any
event, I haven't found much interference from knowing how Smalltalk
classes and metaclasses interact in understanding Ruby.

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/