>>>>> "G" == GOTO Kentaro <gotoken / notwork.org> writes: G> Is this the right error? Well, I'm not really sure with this, it's best to wait for matz pigeon% diff -u eval.c~ eval.c --- eval.c~ Tue Sep 18 05:47:02 2001 +++ eval.c Sun Nov 18 12:47:14 2001 @@ -5597,6 +5597,7 @@ int i; ID id; NODE *body; + VALUE origin; if (TYPE(module) != T_MODULE) { rb_raise(rb_eTypeError, "module_function must be called for modules"); @@ -5614,6 +5615,14 @@ body = search_method(module, id, 0); if (body == 0 || body->nd_body == 0) { rb_bug("undefined method `%s'; can't happen", rb_id2name(id)); + } + for (origin = RCLASS(module)->super; + origin && nd_type(body->nd_body) == NODE_ZSUPER; + origin = RCLASS(origin)->super) { + body = search_method(origin, id, 0); + if (body == 0 || body->nd_body == 0) { + rb_raise(rb_eNameError, "undefined method `%s' in super", rb_id2name(id)); + } } rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC); rb_clear_cache_by_id(id); pigeon% pigeon% cat b.rb #!./ruby module A def x() p 12; end end module B include A module_function :x end B.x pigeon% pigeon% b.rb 12 pigeon% The problem is with this case pigeon% cat b.rb #!./ruby module A def x() p 12; end end module B include A module_function :x end module A def x() p 24; end end B.x pigeon% pigeon% b.rb 12 pigeon% Guy Decoux