Hi,

In message "Re: More flexible inheritance"
    on Sun, 18 Feb 2007 10:24:37 +0900, "Trans" <transfire / gmail.com> writes:

|Then it's easy enough to overlay new behaviors:
|
|  module Xb
|    def a; "{"+super+"}";  end
|  end
|
|  class X
|    include Xb
|  end
|
|  X.new.a  #=> "{a}"
|
|Since that works so well, it occurs to me, why not make this the
|fundamental behavior of defining a class? In other words defining a
|class:
|
|  class X
|    def a; "a"; end
|  end
|
|could be equivalent to writing:
|
|  class X
|    include( Module.new{
|        def a; "a";  end
|    } )
|  end
|
|So there would always be a module involved in the definition of a
|class. And classes become simply containers of modules.

What is the benefit of by this change?  Besides that this change would
make remove_method impossible.

I vaguely think of similar idea with combination of class box, so that
we can control side-effect from open classes, i.e.

  namespace foo  # fake syntax

  # re-opening class that effective only in this namespace
  class String
    def a; "a"; end
  end

  "foo".a  # "a" method available here

But I am still not confident of the benefit and effect of this
behavior.

							matz.