Project

General

Profile

Actions

Bug #3154

closed

Hidden allocate, new and superclass methods on 1.9.2

Added by ujihisa (Tatsuhiro Ujihisa) about 14 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
1.8.8
[ruby-dev:40996]

Description

=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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0