# Sigh -- Matz, *please* can we have this?
def singleton_class
class << self; self; end
end
I have never before given my opinion on this issue, so I think I'll
take this chance to do so. After this message, I promise to shut up
about it.
I agree that singleton_class() should be added to the language.
Here's the pros and cons as I understand them:
Pros
====
* Internally, this is what Ruby calls the class in question
* The C API uses this name all over the place
* Documentation and many books refer to the class as such
* Matz's use of the term predates the design pattern usage
* Anyone learning singleton class functionality is smart enough to
keep it straight from the design pattern of the same name
* None of the other suggestions seems to have won over the masses
* We would have an official name to refer to this concept
Cons
====
* It conflicts with a popular design pattern
To me, the choice is pretty obvious. It's not like it's the first
overloaded term in computing history or anything.
OK, I've said my peace. Thanks for listening.
James Edward Gray II