From: ts Date: 2001-07-20T14:22:37+09:00 Subject: [ruby-talk:18170] Re: Enabling "super" >>>>> "A" == Aleksei Guzev writes: A> (1) A> module M [...] A> class A A> def v def A.v A> "ok" A> end A> include M A> end A> What is equivalent C code? pigeon% cat tt.c #include static VALUE tt_mM, tt_cA; static VALUE tt_v(obj) VALUE obj; { return rb_str_new2("ok"); } static VALUE tt_af(module, klass) VALUE module; { VALUE str = rb_str_new2("--- "); rb_str_append(str, tt_v(klass)); rb_str_append(str, rb_str_new2(" ---\r\n")); rb_funcall(module, rb_intern("print"), 1, str); rb_funcall(module, rb_intern("af_old"), 1 , klass); return module; } void Init_tt() { tt_mM = rb_define_module("M"); rb_define_alias(rb_singleton_class(tt_mM), "af_old", "append_features"); rb_define_singleton_method(tt_mM, "append_features", tt_af, 1); tt_cA = rb_define_class("A", rb_cObject); rb_define_singleton_method(tt_cA, "v", tt_v, 0); rb_funcall(tt_mM, rb_intern("append_features"), 1, tt_cA); } pigeon% pigeon% ruby -rtt -e 1 --- ok --- pigeon% A> Would raise an exception, because "C.v" had not been defined at the A> moment "B.inherited" had been called. I don't think that the goal of inherited is to try to call a method from the class. You are trying to do something strange, for me. Guy Decoux