On 2/18/07, Trans <transfire / gmail.com> wrote:
> 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.
>
> T.

Hi Tom,

The problem to my eyes is that they're not equivalent.

The former is still required when you want to redefine an existing
method in a class, often one you didn't write yourself.  If you change
the former to mean the latter, does that mean we can't redefine
methods like that?

Regards,
George.