From: Gary Wright Date: 2009-11-20T09:49:57+09:00 Subject: Re: Any official name for Ruby's class which makes "class me On Nov 19, 2009, at 5:50 PM, David A. Black wrote: > On Fri, 20 Nov 2009, Florian Frank wrote: > >> David A. Black wrote: >>> The metaclasses are anonymous. The metaclass (or whatever we call >>> it) >>> of String, for example, is a completely separate class/object from >>> String: >> >> Yes. And these things, that shall never be named, aren't much like >> classes either: They cannot create any instances for example. In Ruby >> terminology they are much closer to modules in the sense, that they >> are >> containers of methods, that are used to extend objects. > > I could definitely imagine 'singleton module' instead of 'singleton > class'. I think Matz has commented on this choice but I can't remember > any details. I was thinking along the same lines while reading this thread. There are a few characteristics that seem to argue for class implementation vs a module implementation: -- the class/instance relationship doesn't have an analog with modules and an object can be viewed as an "instance" of its singleton class -- the inheritance relationship of classes provides a structure for searching singleton classes of classes that also no analog with modules These aren't strong reasons for a class implementation over a module implementation but it seems like a module implementation would involve adding special case semantics to the 'singleton modules' that aren't as 'special' in the current singleton class implementation. Gary Wright