From: "Jörg W Mittag" Date: 2009-05-15T09:20:02+09:00 Subject: Re: Superclass of eigenclass Robert Dober wrote: > However, although I agree that those terms are somehow not defined up > to the last detail in Ruby, and I have occasionaly explained about it, You mean "complained", right? Yes, it is kind of unfortunate, that we ended up with this confusion. I would like to point out, however, that this is basically a historical accident, and not anybody's (certainly not matz's) fault. The fundamental problem is that matz has always refused (and still refuses) to pick a name. And over time he has done that for two different reasons. Originally, he considered singleton classes to be a private implementation detail of MRI, and he envisioned that there would be other implementations that would choose to implement singleton methods differently. He wanted to have per-object methods, and he needed something to store them in, so he chose something that was *already* supported by MRI: a class. Additionally, this meant that he needed exactly 0 changes to the method resolution algorithm, and only one single if-condition in the superclass algorithm. *And* he could reuse that same solution for mixins. Unfortunately, that supposedly private implementation was leaked to the programmer, exactly *because* the singleton class is "just a class". Due to the way class bodies work (namely that they return the value of the last expression inside the body instead of the class object, and that self is bound to the class object), you can get access to the singleton class with the 'class << self; self end' trick (or its equivalent). As soon as you can get access to something, you need to name it. And people did. They named it singleton class, eigenclass, virtual class, hidden class, metaclass and dozens more ... Which brings us to the present. *Now* matz refuses to pick a name, because he doesn't want to ... well, *pick* a name. He wants the *community* to pick a name, and he will simply approve whatever we come up with. What it boils down to is that he does *not* consider himself a "benevolent dictator", but more a "benevolent chairman" who does not himself make decisions, but rather tries to "milk" a consensus out of a very diverse group of very opinionated people, just like a chairman of a senate committee would (well, at least in an ideal world where neither the members nor the chairman are corrupt or in any way influenced by lobbyists). Currently, singleton class, eigenclass and metaclass are still in the race. I agree that metaclass is wrong, but since it is the name used by _why the lucky stiff in what is probably one of the best introductory texts about the more esoteric corners of Ruby's object system, a lot of Rubyists learn that name, so it is going to stick with us. Of the other two I prefer eigenclass, both to avoid the confusion with the singleton pattern and because it nicely fits in with the already existing usages in mathematics (eigenvalue, eigenvector, eigenspace, eigenmode, eigenfrequency, eigenstate, eigenspectrum, eigenfunction, eigendecomposition, eigenproblem) and computer science (eigenface, eigenratio). jwm