On Fri, 25 Aug 2006 dblack / wobblini.net wrote:

> I'd rather not see module_eval wrapped/hidden in singleton_class.  I
> see singleton_class as a kind of twin method with class.  In part I'm
> hoping for this because I think it will make it vastly easier for
> people to understand the basic premise that an object has a [birth]
> class and a singleton class, from both of which it draws its
> behaviors.  I don't see an advantage to adding a special twist to
> singleton_class.  If it gives you a class object, you can always call
> module_eval on that, as with any class object.

you could say exactly the same thing about Class.new, Module.new, etc.  i
think the advatage is that

   obj = Object.new

   obj.singleton_class.module_eval{ def foo() 42 end }
       ^^^^^^^^^^^^^^^ ^^^^^^^^^^^
       ^^^^^^^^^^^^^^^ ^^^^^^^^^^^
       hard to explain. harder.  where's the module?


block methods in ruby save time and code scanning.

2 cts.

-a
-- 
to foster inner awareness, introspection, and reasoning is more efficient than
meditation and prayer.
- h.h. the 14th dalai lama