From: dblack@... Date: 2006-08-01T21:19:02+09:00 Subject: Re: Inconsistency in scoping during module_eval? Hi -- On Tue, 1 Aug 2006, Matt Todd wrote: > Yes, absolutely. However, if everything is an object (including a > Module), then that means a Module also has a class? I guess that might > answer my question there, if it has a class and isn't a class... But, > also, wouldn't Module.new be something different than Module itself? I > mean, sure, an instance of a Module isn't a class, but if I'm wrong > about having and being a class, then there is a distinction between > the instance and the class... thing. > > Please help me before I lose track of reality! :) The class Class is a subclass of Module: class Class < Module Either of them can be instantiated: Module.new Class.new Where the diagram chases its own tail a bit is in the fact that both Module and Class are instances of Class. Moreover, Object is a class, but Class is an Object.... In other words, there's definitely a bit of circularity at the top of the tree. By the time you get below Kernel, Object, Module, and Class, it disappears. The circularity is the price we pay for letting Ruby bootstrap the otherwise wonderful object-space into existence :-) David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.