From: nobu@...
Date: 2019-03-06T10:22:13+00:00
Subject: [ruby-core:91700] [Ruby trunk Bug#15640] Inconsistent value passed to respond_to_missing?

Issue #15640 has been updated by nobu (Nobuyoshi Nakada).

Description updated

Good catch.
This behavior was to get rid of inadvertent symbol creation before symbol-GC,
so it is no longer needed.

----------------------------------------
Bug #15640: Inconsistent value passed to respond_to_missing?
https://bugs.ruby-lang.org/issues/15640#change-76966

* Author: kirun (Kieran Leigh)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
If the symbol has been defined, then it is passed. Otherwise a string is passed the first time.    

```ruby
class SomeBug
  def respond_to_missing?(m, *)
    p m
    true
  end
end
���
if false then
  # uncomment to force to symbol--location doesn't matter, just the literal parse:
  # :aa
end
���
sd = SomeBug.new
���
# NOTE: single character strings do not show this behavior
sd.method("aa".to_sym)       # "aa" unless :aa uncommented above
sd.method("aa".to_sym)       # :aa
sd.method("bb".to_sym)       # "bb"
sd.method("bb".to_sym)       # :bb
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>