From: Lionel Thiry Date: 2005-05-16T10:35:30+09:00 Subject: Re: infinite number of singleton_classes David A. Black a �crit : > Hi -- > > On Mon, 16 May 2005, Lionel Thiry wrote: > >> Well, I had something in mind when I wrote this... and it was not >> "Surely no one >> will ever use this feature, then let's remove it". It was something >> more subtle. >> >> I may be wrong in my interpretation, but I remember that Matz expected >> some >> freedom of implementation of singleton method mechanism. Present >> mechanism is >> that singleton methods are hold in a singleton class, which happens to >> be an >> object instance of the class Class. But this may change in future >> version of >> ruby. For example, singleton "classes" could not be a class anymore, >> or it could >> even not be a normal object anymore. It could be anything, whatever >> please Matz. >> >> Then, giving that fact as true, for the sake of future ruby versions, >> wouldn't >> it be more consistent to forbid singleton class of singleton class? > > > It would only be consistent to forbid them if singleton classes > themselves cease to exist (in some future Ruby implementation). As > long as objects have singleton classes, and as long as those classes > are objects, it's consistent for them, too, to have singleton classes. > You have skipped this part of my post in your answer: ----8<---- And, please note this: I agree with you. There is nothing wrong or harmfull in the current behavior, while looking from the point of view of a ruby user. But I think it may be different from the point of view of a language designer and I like to take count of it. ----8<---- The feature is currently avaible, but unless Matz state otherwise, it is an accident, it shouldn't have never happened. Why? Because it may disapear in any future version of ruby. Who said it? Matz himself. It then should be accessible only via special module like evil.rb if one really want the feature. On the other hand, if it was said that ruby won't never change about singleton methods hold in singleton classes, I wouldn't care at all about this. -- Lionel Thiry Personal website: http://users.skynet.be/lthiry/