From: Akinori MUSHA Date: 2011-07-17T18:13:11+09:00 Subject: [ruby-dev:44129] [Ruby 1.8 - Bug #3154][Closed] Hidden allocate, new and superclass methods on 1.9.2 Issue #3154 has been updated by Akinori MUSHA. Status changed from Assigned to Closed 残念ですがもう1.8はこのままです。 ---------------------------------------- Bug #3154: Hidden allocate, new and superclass methods on 1.9.2 http://redmine.ruby-lang.org/issues/3154 Author: ujihisa . Status: Closed Priority: Normal Assignee: Akinori MUSHA Category: core Target version: ruby -v: 1.8.8 =begin ruby 1.9.2から、あるクラスに対してどのその親クラスからもallocate new superclassの3つのメソッドがpublic_methods(false)の一覧に出てこなくなったのですが、これは意図的な仕様変更なのでしょうか。 $ ruby192 -ve 'class A; end; A.ancestors.map {|i| p [i, i.public_methods(false).sort] }' ruby 1.9.2dev (2010-04-02 trunk 27162) [i386-darwin9.8.0] [A, []] [Object, []] [Kernel, [:Array, :Complex, :Float, :Integer, :Rational, :String, :__callee__, :__method__, :`, :abort, :at_exit, :autoload, :autoload?, :binding, :block_given?, :caller, :catch, :eval, :exec, :exit, :exit!, :fail, :fork, :format, :gets, :global_variables, :iterator?, :lambda, :load, :local_variables, :loop, :open, :p, :print, :printf, :proc, :putc, :puts, :raise, :rand, :readline, :readlines, :require, :require_relative, :select, :set_trace_func, :sleep, :spawn, :sprintf, :srand, :syscall, :system, :test, :throw, :trace_var, :trap, :untrace_var, :warn]] [BasicObject, []] RubySpecを修正していてこの変更に気がつきました。ChangeLogや差分やメーリングリストの過去ログやRedMineを見たもののどの部分でどのような意図でこの変更がなされたのか分からなかったため、ここで質問させてください。 これが意図しない変更であった場合、自クラスとその全ての親クラスのpublic_methodsやsingleton_methodsに挙げられていないにも関わらずパブリックに呼び出せるメソッドがあるのは、ちょっと不思議な挙動のように感じます。 =end -- http://redmine.ruby-lang.org