ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: marcandre-ruby-core@marc-andre.ca
To: ruby-core@ruby-lang.org
Subject: [ruby-core:100968] [Ruby master Bug#17197] Some Hash methods still have arity 2 instead of 1
Date: Fri, 20 Nov 2020 08:25:04 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-88629.20201120082503.182@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17197.20200928021357.182@ruby-lang.org

Issue #17197 has been updated by marcandre (Marc-Andre Lafortune).


matz (Yukihiro Matsumoto) wrote in #note-11:
> It is caused by a historical reason. I don't think it's worth breaking compatibility, at least for Ruby3.0. Maybe for 3.1?
> 
> Matz.

Thanks for the reply. Should we add a deprecation warning then?

----------------------------------------
Bug #17197: Some Hash methods still have arity 2 instead of 1
https://bugs.ruby-lang.org/issues/17197#change-88629

* Author: marcandre (Marc-Andre Lafortune)
* Status: Rejected
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* ruby -v: ruby 3.0.0dev (2020-09-26T17:38:39Z master 950614b088)
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
`Hash#each` was changed recently to have arity of 1.
All other methods of `Hash` should behave the same.
Much has been fixed since #14015, but some remains:

```ruby
# Some methods consistently have arity 2:
{a: 1}.select( &->(_kvp) {} ) # => ArgumentError (wrong number of arguments (given 2, expected 1))
```

All in all: `%i[select keep_if delete_if reject to_h]` have their arity still set at 2.




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

  parent reply	other threads:[~2020-11-20  8:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28  2:13 [ruby-core:100192] [Ruby master Bug#17197] Some Hash methods still have arity 2 instead of 1 marcandre-ruby-core
2020-09-28  2:30 ` [ruby-core:100194] " marcandre-ruby-core
2020-09-28  9:13 ` [ruby-core:100196] " eregontp
2020-09-28  9:28 ` [ruby-core:100197] " eregontp
2020-10-23 21:08 ` [ruby-core:100516] " marcandre-ruby-core
2020-11-16  7:59 ` [ruby-core:100867] " mame
2020-11-16 14:04 ` [ruby-core:100875] " daniel
2020-11-16 22:37 ` [ruby-core:100880] " eregontp
2020-11-17 13:37 ` [ruby-core:100899] " daniel
2020-11-17 14:24 ` [ruby-core:100900] " mame
2020-11-20  7:34 ` [ruby-core:100964] " matz
2020-11-20  8:25 ` marcandre-ruby-core [this message]
2020-11-26 12:33 ` [ruby-core:101092] " matz
2020-11-30 19:22 ` [ruby-core:101166] " daniel

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-88629.20201120082503.182@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).