From: Charles Oliver Nutter Date: 2010-03-23T07:46:09+09:00 Subject: Re: Singleton methods without the singleton class On Mon, Mar 22, 2010 at 1:44 PM, Intransition wrote: > How do you handle #extend? I don't :) #extend would be hard to support with this, since module methods are often only callable against the object themselves; in other words, if the module doesn't *actually* get inserted into the object's class hierarchy, the methods won't be invokable. Again, this can be forced under the covers in JRuby, but not through any normal Ruby mechanisms I know of. > I've always thought it would be wise if singleton methods were added > to an anonymous module rather then directly to the object.* Perhaps > taking this approach will work for JRuby. While not exactly like MRI > it should be close enough for all practical purposes. > > (* Which is why Facets extends the #extend method to do exactly that > if you supply it a block.) Yes, that's probably wise, but #extend is mostly a deal-breaker in any form because it forces a singleton object to be created. - Charlie