On Sat, Mar 22, 2008 at 11:28 PM, Rick DeNatale <rick.denatale / gmail.com> wrote:
> On 3/22/08, Trans <transfire / gmail.com> wrote:
>
>  >  > I also side with Jim Weirich about the
>  >  > distinction between metaclass and singleton class or eigenclass or
>  >  > whatever you want to call them.
>  >
>  >
>  > That's Smalltalk not Ruby. I understand the distinction people want to
>  >  draw, but in Ruby they are the same construct.
>
>  I respectfully disgree.
>
>  Singleton classes in Ruby are an implementation construct which is
>  used for two distinct purposes:
>
>  1) To provide a place to put instance behavior.  For example
>
>     a = "abc"
>     def a.foo
>          :foo
>     end
>
>  2) To provide a class for a class, i.e. a metaclass.
>
>  One difference is that the first can't have subclasses, while
>  singleton classes used as metaclasses can and must since the
>  inheritance chain of metaclasses parallels the inheritance chain of
>  their instances.
Hmm, this indeed would make me think about the possibility to use
metaclass as a special case of a singleton class of a
module.

(1) class << Object.new; self end  is a singleton class but not a metaclass
(2) class << Module::new; self end is a metaclass and a singleton class by (1)

I never really noticed if this is used consistently as such, my bad AAMOF.

Cheers
Robert


-- 
http://ruby-smalltalk.blogspot.com/

---
Whereof one cannot speak, thereof one must be silent.
Ludwig Wittgenstein