From: matz@... (Yukihiro Matsumoto) Date: 2001-10-06T12:14:59+09:00 Subject: [ruby-talk:22147] Re: Why does Class undefine module_function? Hi, In message "[ruby-talk:22135] Why does Class undefine module_function?" on 01/10/06, Jeremy Henty writes: |/usr/local/src/ruby-1.6.5/eval.c: line 5961 | | rb_undef_method(rb_cClass, "module_function"); | |Out of interest, why? There's no comment in the source, and I haven't |found an explanation in the ruby-talk archives or the Pickaxe book. I |see no reason why a class should not invoke module_function just as a |module can. What am I missing? Remove that line, recompile, then try the following. class String module_function :sub end String.sub(/a/, "b") It would crash the interpreter. matz.