Yukihiro Matsumoto wrote:

> I am not thinking about implementation detail yet.  What do you think
> how it should behave?

It's not as simple as it seems. After manuevering past the potential
for infinite recursion on #include, I've see another issue: the old
Dynamic Module Inclusion problem. This is what I'm playing with:

  class Module

    def class_extension( *mods, &blk )
      unless @class_extension
        @class_extension = Module.new
        def @class_extension.append_features( base )
          append_features_without_extension( base )
        end
        extend @class_extension
      end
      @class_extension.module_eval(&blk) if blk
      @class_extension
    end

    alias_method :append_features_without_extension, :append_features

    def append_features( base )
      ce = class_extension
      base.class_extension { include ce }
      append_features_without_extension( base )
    end

  end

Problem is that 'extend @class_extension' doesn't work unless it occurs
_after_ the module_eval(&blk). Which means later changes to the
extensions module will have no effect on modules that have already
included it. Not good. So unless I've misanalyzed this, I think keeping
a running list of extension modules, more like my previous
implementation post, is going to be neccessary.

T.