[#49078] DevelopersMeeting20150728Japan — SASADA Koichi <ko1@...>
Hi,
5 messages
2015/06/12
[ruby-dev:49014] [Ruby trunk - Bug #11213] defined?(super) ignores respond_to_missing?
From:
ko1@...
Date:
2015-06-02 20:11:41 UTC
List:
ruby-dev #49014
Issue #11213 has been updated by Koichi Sasada.
However it is difficult because we can't call `self.respond_to_,missing?` directly because we should ignore `C1#respond_to_missing?`.
Options:
(1) Ignore this issue as a spec (or known issue)
(2) Do `super` (it has compatibility issue)
(3) Introduce something special to call `respond_to_,missing?`
My recommendation is (1).
----------------------------------------
Bug #11213: defined?(super) ignores respond_to_missing?
https://bugs.ruby-lang.org/issues/11213#change-52721
* Author: Koichi Sasada
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* ruby -v: 2.3dev
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
```ruby
class C0
def method_missing *args
p [:method_missing] + args
end
def respond_to_missing? *args
true
end
end
class C1 < C0
def foo
super
defined?(super)
end
end
p C1.new.foo
```
This script prints
```
[:method_missing, :foo]
nil
```
In this case, we can call super, but defined? returns nil.
It should be a bug.
--
https://bugs.ruby-lang.org/