From: Mathieu Bouchard Date: 2006-08-01T14:13:35+09:00 Subject: Re: Inconsistency in scoping during module_eval? 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? Each module and each class have a class which are all subclasses of the Class class. It's as in the Object/Class loop in Java and Smalltalk except that in Ruby it's the trinity Object/Module/Class... [just like a certain tritheistic concept that was grafted onto the Christian religion(s) by the Council of Nicaea some 300 years after the fact.] > if it has a class and isn't a class... Whether a module is a class is a lexicographic matter: it's a class in the ruby sense of the word "class", but it's a class by pretty much any other language's standards. This is the very device that conceals Ruby's support for multiple inheritance. > 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. Yes. Those relationships are well-documented in the Pickaxe 1 (I don't have Pickaxe 2 so I can't tell). They are also surely well documented in the manuals of some other languages (just without the Module/Class distinction). In my opinion, the difficulty in learning those relationships is caused by pathological usage of metonymy (http://en.wikipedia.org/wiki/Metonymy), like confusing an object and the class of that object. For example, if i say that Potato responds to "blah", am I talking about the instances of Potato or about the Potato class itself? _ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tel:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montreal QC Canada