Hi,

In message "[ruby-talk:02050] Re: Anonymous and Singleton Classes"
    on 00/03/21, B_DAVISON <Bob.Davison / reuters.com> writes:

|OK, so would I be right in saying that it's an implementation thing and you
|want to keep that hidden so the implementation can change?  Perhaps using the
|term 'class' in the description of these things is misleading (or might be in
|the future if the implementation changes :-)

Hmm, there was discussion about this matter before, without explicit
conclusion.  Let's talk it again.  What should we call `class <<obj'
statement?

|It a similar sort of thing going on with the class Class?  I was a bit confused
|by the description of Class in the Ruby Reference Manual where you start
|describing an unnamed meta-class that is actually the class of each class but
|then say that it is complicated and stop.  Guessing from above is the class of
|each class a singleton class of Class?

I'm not sure how much I should describe implementation details.
Conceptually, a class inherits singleton methods also from its
superclass.  That's all.

In current implementation, they are done by internal hidden class
called `singleton class', which is real class of classes.  You can
consider this hidden class a metaclass.  Better description is welcome.

|Would still be grateful for your help with the following though.
|When I was trying to find out about subclasses I tried defining Class.inherited
| rather than C1.inherited and got no output even when creating a named
|subclass.  To my mind C1 was an instance of Class and inherited an instance
|method of Class therefore C1 should inherit Classes implementation of
|inherited.

  def Class.inherited(c)
    ...
  end

defines a class method of Class, which is shared by subclasses of
Class.  C1 is a instance of Class, but not a subclass of Class. So you
should have

  class Class
   def inherited(c)  # override default `inherited'
     ...
   end
  end

By the way, how many times did I type `class' in this mail? :-)

							matz.