From: Hal Fulton Date: 2005-05-07T02:56:57+09:00 Subject: Re: [RCR] Object#inside_metaclass? Ilias Lazaridis wrote: > A "singleton class" is instantiated to 0..1 object You're thinking of the Singleton pattern, which deals with a class which can only be instantiated once, resulting in a single object. The term "singleton" simply means "something which is unique or occurs only once." The term "singleton" is used in the Ruby community to mean several things: - an object of a class which can only be instantiated once (Singleton Pattern) - a method that is unique to its object, rather than originating in the class of the object - an object containing methods that are unique to that object, i.e., containing singleton methods When we say "singleton class," we are not really saying "a class which is a singleton." In English, the adjective does not always modify the noun in the same way. "Human Services" means services FOR humans; a "Reptile Zoo" is a zoo OF reptiles (not one that we intend reptiles to visit and pay admission). We use the term "singleton class" not to signify "a class that is a singleton," but rather to signify "a class where we store the singleton methods." To add to the confusion, a class in Ruby is an object. So when is a class anything *but* a singleton? Is there more than one occurrence of Fixnum in Ruby? I suppose we could do Fixnum.dup and there would be. In short, the Ruby community's usage is not 100% in line with the rest of the CS community. But that is OK, because 1) even the CS community at large does use terms with 100% consistency, and 2) we are using terms for concepts that do not exist in most other OO languages. Hal