From: "ara.t.howard" Date: 2007-09-11T02:46:45+09:00 Subject: Re: Singleton Modules rather than Singleton Classes On Sep 1, 2007, at 2:14 PM, Logan Capaldo wrote: > > Counter proposal: remove singleton classes all together in favor of > simply having singleton methods. The useful facility of a singleton > class is that it allows you to have per-object methods (singleton > methods). Class and module are both misnomers for the "thing that acts > as a place to store singleton methods." By eliminating the visibility > of this implementation detail, it allows for other implementations to > be experimented with. The more you pin down how singleton methods are > implemented, and the more you start doing things with details of that > implementation the hard it becomes to have flexibility in that > implementation. This also removes the need to justify referring to > them as classes, and the false expectations this creates. My 2cents.. i think i've done as much meta-programming as anyone out there and i would not like to see that chance. the reason is that the singleton_class is also a nice place to store *state* - not only methods - when doing deep ruby magic. otherwise the whole affair of transforming singleton classes into modules seems reasonable but superfluous to me: it's just so easy to do module M; def x() 'x' end; end class A; extend M; end class B; extend M; end B.x #=> 'x' that is hardly seems worth all the c coding and inevitable bugs even though the idea seems sounds. maybe 2.0? 2cts. a @ http://drawohara.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama