ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: hanmac@gmx.de
To: ruby-core@ruby-lang.org
Subject: [ruby-core:91701] [Ruby trunk Bug#15640] Inconsistent value passed to respond_to_missing?
Date: Wed, 06 Mar 2019 10:40:15 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-76967.20190306104014.2f6ec5c0cf652433@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15640.20190306002224@ruby-lang.org

Issue #15640 has been updated by Hanmac (Hans Mackowiak).


@nobu should the value depending on the value used for method, or should respond_to_missing? always has Symbol as parameter?

i think the best would be to make it simple and always have it use Symbol

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

* 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/

      parent reply	other threads:[~2019-03-06 10:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15640.20190306002224@ruby-lang.org>
2019-03-06  0:22 ` [ruby-core:91683] [Ruby trunk Bug#15640] Inconsistent value passed to respond_to_missing? bugs_ruby
2019-03-06 10:22 ` [ruby-core:91700] " nobu
2019-03-06 10:40 ` hanmac [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-76967.20190306104014.2f6ec5c0cf652433@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).