Hello


>  it has found Foo#exit before Mod#exit
>
>  If you add #super in Foo#exit it will call Mod#exit

	Yes, but then I might just as well subclass Mod.
	I wanted to add Mod to a finished Foo.

	The Mod using append_features does just what I wanted.

	But another problem arises, as it does not work with "initialize".
	Initialize is not yet defined, when the class_eval happens.

	I find it rather strange, that initialize should be added after other
	method definitions.


> pigeon% cat b.rb
> #!/usr/bin/ruby
> module Mod
>    def self.append_features(kl)
>       super
>       if kl.method_defined?(:foo) && !kl.method_defined?(:origFoo)
>          kl.class_eval <<-EOT
>             alias_method :origFoo, :foo
>             def foo(code=0)
>                puts 'foo code ' + code.to_s
>                origFoo(code)
>             end
>          EOT
>       end
>    end
> end
>
> class Foo
>    def foo(code=0)
>      puts code
>    end
> end
>
> class Foo
>    include Mod
> end
...
>
> Guy Decoux