The thing is, there's one big difference that's not just a matter of
implementation: singleton classes of Class objects are the only ones
that can actually be called by more than one object (the class, plus
its descendants). So that calls into question the appropriateness of
"singleton" as a way of describing them. I'm not a fan of "metaclass"
-- as Jim Weirich (if I recall correctly) said, the only real
metaclass in Ruby, i.e., class of classes, is Class.
And from my viewpoint, that last sentence doesn't seem right, true as
it might be from the current implementation of Object#class. First of
all, if the only real metaclass is Class, then what are those
singleton classes of classes for?
Each one holds the methods for it's sole instance, and for inheritance
by it's sub[class?]es. They are just like classes in that regard.
Hiding the fact that they exist, and giving the illusion that all
Class objects are instances only of Class doesn't seem to be natural
and leads to anomalies like making the concept of protected class
methods empty since the all classes are considered to have the same
class.
And since there really is a distinction between the singleton classes
used for instance behavior, and those sort-of-singleton class thingies
why not have a term which distinguishes them. Metaclass is the common
term for these kinds of objects, and under the covers, ruby singleton
classes of classes look very much like the metaclasses of Smalltalk or
CLOS.
I think it would be interesting to think about what would break if the
following methods were defined/changed.
1) Object#singleton - would return the singleton class of an
instance, creating it if necessary.
2) Module#metaclass - returns the singleton class of the receiver.
3) Object#class - returns the 'birth class' of the object.
Module "overrides" the implementation of this method to return
the metaclass of the receiver.