From: "David A. Black" Date: 2009-11-17T20:30:36+09:00 Subject: Re: Any official name for Ruby's class which makes "class me --1926193751-2105397092-1258457422=:9137 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-2105397092-1258457422=:9137" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-2105397092-1258457422=:9137 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT Hi -- On Mon, 16 Nov 2009, Marnen Laibow-Koser wrote: > Hunt Jon wrote: >> We all know Ruby really doesn't have class methods. >> >> But how do you call such classes that have "class methods"? >> I hear Japanese say 特異 class, but is there any English word for that? > > You mean instances of class Class? The official docs call them > metaclasses. I don't think that's right. String and Array and class MyClass and Class.new are all instances of Class, but they're not metaclasses. Actually, I think it was Jim Weirich who pointed out that, given the usual sense of the term "metaclass" as a class which produces other classes, Class itself is the only metaclass in Ruby. The term is sometimes used to refer to singleton classes in general, and sometimes to refer only to singleton classes of Class objects: s = "" class << s; self; end # s's singleton class class << String; self; end # String's singleton class or metaclass This usage (using it for classes' singleton classes) has some justification because classes' s. classes aren't quite the same as those of other objects (they allow for method-sharing by subclasses, so they're not strictly "per-object" definitions). I myself usually stick to "singleton class" all around, partly just to do my bit to stop the name-proliferation madness :-) I don't see anything "meta" about singleton classes in general, so I don't call them metaclasses. >> Is eigenclass an official name for that? No (at least, I hope not :-) Matz had expressed uncertainty about the naming scheme, and a bunch of more or less whimsical names were suggested, some of which seem to have a certain following. The unfortunate effect is that it's all a bit unclear. I recommend "singleton class", plus "metaclass" for classes' singleton classes if you feel strongly about their special status. I'll add that in nine years of using Ruby, I have yet to see more than perhaps one or two cases of confusion between singleton classes and classes that include the Singleton module (totalling about four seconds and cleared up with: "No, that's different"), though that coincidence of names is often adduced as evidence that "singleton class" must be a confusing name. David -- THE COMPLEAT RUBYIST, Ruby training with Black/Brown/McAnally! January 22-23, Tampa, Florica Info and registration at http://www.thecompleatrubyist.com -------------------------------------- My new job: http://tinyurl.com/yfpn9hz --1926193751-2105397092-1258457422=:9137-- --1926193751-2105397092-1258457422=:9137--