Eric Mahurin <eric_mahurin / yahoo.com> writes:

> Daniel,
>
> I haven't really followed this VERY long thread completely,

Who could blame you, really? :-)

> but I'd thought I'd jump in.  What was the exact proposal
> to unify class and module?

Quoting Mathieu Bouchard's proposal[1] from two years ago,

    1. Module == Class returns true, and so no longer
       Module < Class returns true.  Therefore,
       Module#include would work with Class arguments and
       class A < x would work for any Module x.
    
    2a. Class#new is moved to Object.new.  [Mathieu
        accidentally swapped the hash and dot in his
        original message.]  A Class that does not have
        Object in its ancestor list does not inherit from
        Object.new and is thus uninstantiable.

      OR

    2b. Class.new stays where it is. Former Modules thus
        become instantiable (though not necessarily
        meaningfully).

I would go for 2a, because I don't see any reason to allow
former modules to be instantiated at the expense of not
being able to have a non-instantiable class/module.
    
    3. The "class" and "module" keywords would become
       equivalent.  Maybe the difference would be that the
       default for "class" is to inherit from Object, and
       the default for "module" is to not inherit at all.
    
    4. A Class can inherit from another Class.
       The inheriting Class may have Object twice in its
       ancestors, but Ruby's ancestor lookup would eliminate
       duplicates in the same way that non-Class Modules are
       when they are duplicately #included according to the
       rules of the current system.

Mathieu then went on to list the difficulties he could see
with implementing this, only one of which was technical:

    If Class === B and Class === A and B < A, then also
    (class << B ; self ; end) < (class << A ; self ; end).
    This does not occur if A is a non-Class Module, nor in
    any other case.

    A Class inheriting from another cause the corresponding
    metaclasses to inherit from each other.  This has an
    effect on "class methods".  This thing currently does
    not happen in non-Class Modules.  I wonder whether there
    are adverse consequences of making it happen in
    non-Class Modules.  I have not fully examined yet.
    This may be the only outstanding technical issue.

This is the issue that I and Ara have been discussing
recently, and I have been trying to understand whether there
was good reason for the difference in the first place.

-- 
Daniel Brockman <daniel / brockman.se>

[1] <http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/1442>