-----Original Message----- From: Florian Gross [mailto:flgr / ccan.de] Sent: Sunday, May 16, 2004 11:54 PM To: ruby-talk ML Subject: Re: Singleton classes rolo wrote: > Is use of singleton class a specification of ruby or it is implementation > choice? for example, we can define internal structure for objects in such a > way that it contains message table. Florian Gross wrote: I heavily assume that it's part of the language specification, because we have this syntax: obj = "foo" class << obj # everything in here is executed in the context of the singleton class def reverse; "bogus"; end end obj.reverse # => "bogus" -> yes, but this does not mean we have singleton classes as such. This only means that message reverse belongs obj. The inherent assumption is that message processing is part of class and not object. Hence singleton class. If the Objects themselves can process message we do not need an explicit singleton class. This syntax shall remain even if there is no singleton class. rdgs, rolo