From: Christophe Grandsire Date: 2005-10-14T15:34:45+09:00 Subject: Re: instance from class name? Selon Alexander Lamb : > Ah, I understand. Simply a class method (like in Objective-C). That's how it comes out yes :) . I guess I could have said it just that way, but then you'd still wonder why it was not in the documentation for Object :) . The thing to remember is that class methods are nothing more than instance methods on the class object (when one defines class methods, one is just adding singleton methods to the class object). I just > wasn't careful about the fact in inherited from Module (the class > object hierarchy). This can be difficult to understand for Java > developer who don't have real class objects and where static > functions are not inherited. > The small diagram in the documentation of Class (you can see it by running ri Class, or by looking in http://ruby-doc.org/core/ for the documentation of class Class) is a good thing to keep in mind. It shows how the class Object is an object of class Class, while at the same time Class inherits from Object via Module ;) . I must admit it took me a while to get it ;) . And I still sometimes get confused, which is why my explanation must have looked a bit confusing. I was trying to rebuild my knowledge of the thing at the same time I wrote :) . -- Christophe Grandsire. http://rainbow.conlang.free.fr It takes a straight mind to create a twisted conlang.