From: shugo@... (Shugo Maeda) Date: 1997-12-20T15:14:53+09:00 Subject: [ruby-list:5739] Re: ruby 1.1b2 released --Multipart_Sat_Dec_20_15:21:10_1997-1 Content-Type: text/plain; charset=ISO-2022-JP 前田です。 In message "[ruby-list:5732] ruby 1.1b2 released" Yukihiro Matsumoto wrote: | private/publicに続くvisibility - function | 一見privateだが継承しない class Foo def foo puts "foo" end function :foo end f = Foo.new p f.respond_to? :foo #=> false f.foo #=> foo のようにrespond_to?はfalseなのに,実際には呼び出せてしまうようです。 --Multipart_Sat_Dec_20_15:21:10_1997-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="eval.c.diff" Content-Transfer-Encoding: 7bit --- eval.c.orig Sat Dec 20 14:58:15 1997 +++ eval.c Sat Dec 20 15:00:14 1997 @@ -3027,7 +3027,7 @@ } /* receiver specified form for private method */ - if (noex == NOEX_PRIVATE && scope == 0) + if ((noex == NOEX_PRIVATE || noex == NOEX_FUNCTION) && scope == 0) return rb_undefined(recv, mid, argc, argv, CSTAT_NOEX); switch (the_iter->iter) { --Multipart_Sat_Dec_20_15:21:10_1997-1 Content-Type: text/plain; charset=ISO-2022-JP あと継承しないということは, class Foo def foo puts "foo" end function :foo end class Bar < Foo def bar foo end end b = Bar.new b.bar は本来ならエラーということでしょうか? その場合, class Foo def foo puts "foo" end function :foo def bar foo end end class Bar < Foo end b = Bar.new b.bar もエラーになります? # b2では両方ともエラーになりませんよね? -- 前田 修吾 --Multipart_Sat_Dec_20_15:21:10_1997-1--