From: Christoph Date: 2005-05-09T09:31:54+09:00 Subject: Re: Singleton class terminology David A. Black schrieb: > > There was a brief flurry of discussion of having it be a singleton > module, which I actually think is potentially good. I can't remember > which of these threads it was on... but searching for "singleton > module" will probably unearth it. You are surely aware that we already have a module called Singleton (sort of implementing the OO variant of a Singleton). Since the potential ambiguities between the OO version and Ruby's use of the term "singleton", is the whole unholy raison d'etre for this gigantic never ending singleton, meta, whatever class threads, you'd be open the flood gate threads about the difference between �a singleton module" and "the singleton module" if you start calling non OO "singleton classes" "singleton module". I am particularly looking forward for discussions about the�singleton module" of an OO-singleton class and the "singleton module" of the (OO) Singleton module:-) > > Matz has also talked about the fact that the singleton class is really > just one way to implement per-object modification. He'd mentioned a > "class-like object" that might not actually be a class. Some > questions arose in that context, like: would there be a class > interface to it? what would class << obj; self; end give you? etc. Of course you and Hal open up a serious issue if the class of what we currently call "singleton class" really should be a class, after all - that if -- p class << obj; self end.class == Class --- should return true, If I understand you correctly you are sort of suggesting that we'll get p class << obj; self end.class == Module # true ?? As a variant we could subclass Module as in --- class VirtualMetaWhateverModule < Module end class << obj; self end.class == VirtualMetaWhateverModule # true --- I felt for a long time that the many tests for FL_SINGLETON flags in Ruby�s source code could be simplified by sub classing from class, e.g. -- class MetaClass < Class; end # that�s is p class << obj; self end.class == MetaClass # true --- Since this is fairly obvious I am sure that Matz must have already rejected this in his mind, however I must confess that I secretly wish that Matz would seriously consider tinkering with the "root" of Ruby�s Object hierarchy for Ride and instead of (only) tinkering with names instead (this root top is important and quite possibly improvable IMO). As thing are, I hope Matz will stick with singleton class/methods or change to "individual class/modules" and we can all move on ... /Christoph > > > David >