From: "ozydingo (Andrew Schwartz) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "ozydingo (Andrew Schwartz)" <noreply@ruby-lang.org>
Subject: [ruby-core:117635] [Ruby master Misc#20441] Should passing keyword args to method_name(*) be an error?
Date: Sun, 21 Apr 2024 14:33:51 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-108043.20240421143351.10397@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-20441.20240421082521.10397@ruby-lang.org
Issue #20441 has been updated by ozydingo (Andrew Schwartz).
Understanding better the role of `ruby2_keywords` is helping, thank you. It seemed to me that either way some compatibility was broken, but the subtleties of maintaining compatibility as well as possible in a variety of circumstances is indeed tricky. I appreciate your time explaining it further here.
----------------------------------------
Misc #20441: Should passing keyword args to method_name(*) be an error?
https://bugs.ruby-lang.org/issues/20441#change-108043
* Author: ozydingo (Andrew Schwartz)
* Status: Open
----------------------------------------
In the following method:
```rb
def foo(*)
super
end
```
it is apparently the intended ruby 3 behavior to pass keyword args as a positional Hash to `super`. I believe this is confusing and can lead to hidden and hard-to-discover bugs (e.g. #20440). Since `*` is meant to only represent positional args, should it be an ArgumentError to pass keyword args at all to this method? Similar to how it is an error to pass positions args to `bar(**)`.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/
prev parent reply other threads:[~2024-04-21 14:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-21 8:25 [ruby-core:117631] [Ruby master Misc#20441] Should passing keyword args to method_name(*) be an error? ozydingo (Andrew Schwartz) via ruby-core
2024-04-21 8:33 ` [ruby-core:117632] " zverok (Victor Shepelev) via ruby-core
2024-04-21 8:47 ` [ruby-core:117633] " ozydingo (Andrew Schwartz) via ruby-core
2024-04-21 8:58 ` [ruby-core:117634] " zverok (Victor Shepelev) via ruby-core
2024-04-21 14:33 ` ozydingo (Andrew Schwartz) via ruby-core [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-108043.20240421143351.10397@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
--cc=noreply@ruby-lang.org \
--cc=ruby-core@ml.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).