On Dec 2, 2010, at 11:47 AM, Intransition wrote:
> On Dec 2, 12:25 am, Tony Arcieri <tony.arci... / medioh.com> wrote:
>> Every time I think I have my head around what these terms mean I seem =
to run
>> across someone with a completely different definition.
>>=20
>> My understanding was that the singleton class is what you obtain when =
you
>> call self.class in instance scope, and that metaclass and eigenclass
>> are interchangeable terms for what you obtain if you call class << =
self;
>> self; end in instance scope.
>>=20
>> Is this correct? Do you have a different definition?
>=20
> Technically they are all the same.

Perhaps it was the original question that was confusing but they
are not all the same.  There are two different situations in the
examples given by the original poster:
   =20
1)  object.class in any context is the class of which 'object' is
    an instance

    self.class is just a particular example of this for 'self'

2) =20

Ruby 1.9.2:=20
    object.singleton_class in any context is the (perhaps newly
    created) singleton class for 'object'

    self.singleton_class is again just a particular example
    of this for 'self'

Prior to Ruby 1.9.2:
    The expression, (class <<object; self; end), was needed to
    access the singleton objects as there was no standard method
    that returned a reference to the singleton class.

self.class and self.singleton_class are both classes but they
each play their own separate role in Ruby's method lookup
process.

There has been a long running debate in the Ruby community as to
what to name the object returned by (class <<object; self; end) but
with the introduction of Object#singleton_class in 1.9.2 that debate
is effectively over.

The most common alternative names were eigenclass, metaclass, and
perhaps virtual class as well as a long list of other variations.
Each one had its pros/cons but "singleton class" is the one that
Matz settled on in 1.9.2.

Gary Wright