On 8/9/06, Arnaud Bergeron <abergeron / gmail.com> wrote:

> Think of it like this: Modules are like Java interfaces, but with a
> method definition provided.
>
> If you want to be more OO generic, Modules are classes that cannot be
> instanciated, but otherwise have all the functionality of classes.

True as a first approximation.  To be more correct as to ruby.  A
Module is a container (namespace) which can contain constants, class
variables and methods.  Note that the constants can be:

  * simple constants
        Constant = 1
  * classes
        class Foo
         end
  * modules
        module Bar
        end

Classes are subclasses of Module which also provide for instantiation.
 When you include(mixin) a module in a class all of the modules
constants, class variables, and methods are added to the class.

And since classes are subclasses of module they can do everything a
module can do, EXCEPT that the include method in Module will complain
if you try to include a class in another class.

-- 
Rick DeNatale

http://talklikeaduck.denhaven2.com/