Project

General

Profile

Actions

Bug #22470

closed

Array#find and Array#rfind arity change between versions 3 and 4

Bug #22470: Array#find and Array#rfind arity change between versions 3 and 4

Added by swebb (Steven Webb) 6 days ago. Updated 6 days ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:127228]

Description

Ruby 4 introduced native implementations of Array#find and Array#rfind (Feature #21678). However, the new implementations changed how it behaves with multiple arguments:

ruby 3.4.8:

ruby -e "[].find(1, 2)"
-e:1:in 'Enumerable#find': wrong number of arguments (given 2, expected 0..1) (ArgumentError)
	from -e:1:in '<main>'

ruby 4:

ruby -e "[].find(1, 2)" # returns an instance of Enumerable and doesn't generate any output

This feels like a bug to me as it means Array#find no longer has the same behaviour as Enumerable#find.

Updated by Earlopain (Earlopain _) 6 days ago Actions #2

  • Status changed from Open to Closed
  • Backport changed from 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED
Actions

Also available in: PDF Atom