なかだです。

なひさんによると

  $ ruby-1.6 -e 'module Foo; module_function :to_s; end'

  $ ruby-1.8 -e 'module Foo; module_function :to_s; end'
  -e:1: [BUG] undefined method `to_s'; can't happen
  ruby 1.8.1 (2004-01-06) [i686-linux]

  $ ruby-1.9 -e 'module Foo; module_function :to_s; end'
  -e:1: [BUG] undefined method `to_s'; can't happen
  ruby 1.9.0 (2004-01-06) [i686-linux]

だそうです。


Index: eval.c =================================================================== RCS file: /cvs/ruby/src/ruby/eval.c,v retrieving revision 1.624 diff -u -2 -p -r1.624 eval.c --- eval.c 2 Jan 2004 16:21:15 -0000 1.624 +++ eval.c 6 Jan 2004 10:57:35 -0000 @@ -7047,5 +7047,5 @@ rb_mod_modfunc(argc, argv, module) id = rb_to_id(argv[i]); - for (;;) { + do { body = search_method(m, id, &m); if (body == 0 || body->nd_body == 0) { @@ -7056,5 +7056,5 @@ rb_mod_modfunc(argc, argv, module) } m = RCLASS(m)->super; - } + } while (m); rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC); }
-- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦