遠藤です。

2010年6月27日0:09 Akinori MUSHA <knu / idaemons.org>:
> At Wed, 24 Feb 2010 01:25:45 +0900,
> matz wrote:
>> In message "Re: [ruby-dev:40465] Re: respond_to?(<protected method name>) returns true"
>>     on Wed, 24 Feb 2010 01:12:55 +0900, "Akinori MUSHA" <knu / iDaemons.org> writes:
>>
>> |> 前のメールでも書いたように method_missing による偽陰性は存在
>> |> するので、本質的には指摘は当たっているのですが。で、偽陰性の
>> |> 排除についてですが、ちょっと考えた結果、賛成します。
>> |
>> | ご検討ありがとうございます。賛成くださるのは偽陽性の排除ですよね。
>>
>> あ、そうです。protectedに対してrespond_to?が真を返しているの
>> を偽に統一するということですね。
>
>  だいぶ間が空いてしまいましたが、これでどうでしょうか。


これによって rubyspec が以下のようにエラーを出すようになりました。
# marc-andre が直してくれるかなあ


2)
Kernel#respond_to_missing? isn't called when obj responds to the given
protected method FAILED
Expected false to be true
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_missing_spec.rb:65:in
`block (3 levels) in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_missing_spec.rb:5:in
`block in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_missing_spec.rb:4:in
`<top (required)>'

3)
An exception occurred during: Mock.verify_count
Kernel#respond_to_missing? isn't called when obj responds to the given
protected method FAILED
Mock '#<KernelSpecs::A:0x859f65c>' expected to receive
'respond_to_missing?' exactly 0 times
but received it 1 times
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_missing_spec.rb:5:in
`block in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_missing_spec.rb:4:in
`<top (required)>'

4)
Kernel#respond_to_missing? isn't called when obj responds to the given
protected method, include_private = true FAILED
Expected false to be true
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_missing_spec.rb:70:in
`block (3 levels) in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_missing_spec.rb:5:in
`block in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_missing_spec.rb:4:in
`<top (required)>'

5)
An exception occurred during: Mock.verify_count
Kernel#respond_to_missing? isn't called when obj responds to the given
protected method, include_private = true FAILED
Mock '#<KernelSpecs::A:0x8224f90>' expected to receive
'respond_to_missing?' exactly 0 times
but received it 1 times
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_missing_spec.rb:5:in
`block in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_missing_spec.rb:4:in
`<top (required)>'

6)
Kernel#respond_to? returns true if obj responds to the given protected
method FAILED
Expected false
 to equal true

/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_spec.rb:30:in
`block (2 levels) in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_spec.rb:12:in
`<top (required)>'

7)
Kernel#respond_to? returns true if obj responds to the given protected
method, include_private = true FAILED
Expected false
 to equal true

/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_spec.rb:36:in
`block (2 levels) in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_spec.rb:12:in
`<top (required)>'

8)
Kernel#respond_to? returns true if obj responds to the given protected
method FAILED
Expected false
 to equal true

/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_spec.rb:42:in
`block (2 levels) in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/kernel/respond_to_spec.rb:12:in
`<top (required)>'

9)
Delegator#method returns a method object for protected methods of the
delegate object ERROR
NameError: undefined method `prot' for class `DelegateSpecs::Delegator'
/home/mame/work/ruby/spec/rubyspec/library/delegate/delegator/method_spec.rb:17:in
`method'
/home/mame/work/ruby/spec/rubyspec/library/delegate/delegator/method_spec.rb:17:in
`block (2 levels) in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/library/delegate/delegator/method_spec.rb:4:in
`<top (required)>'

10)
SimpleDelegator.new forwards protected method calls ERROR
NoMethodError: undefined method `prot' for #<DelegateSpecs::Simple:0xf73daac>
/home/mame/work/ruby/spec/rubyspec/library/delegate/delegator/send_spec.rb:15:in
`block (2 levels) in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/library/delegate/delegator/send_spec.rb:4:in
`<top (required)>'

-- 
Yusuke Endoh <mame / tsg.ne.jp>