From: "k0kubun (Takashi Kokubun) via ruby-core" Date: 2026-11-16T17:59:17+00:00 Subject: [ruby-core:127523] [Ruby Bug#22470] Array#find and Array#rfind arity change between versions 3 and 4 Issue #22470 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED to 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ruby_4_0 commit:8dab0855efe82ea4266b24f02ca1f0eb25a3a51f merged revision(s) commit:28dec96d044b72c14920cad434dd270ddcd412da. ---------------------------------------- Bug #22470: Array#find and Array#rfind arity change between versions 3 and 4 https://bugs.ruby-lang.org/issues/22470#change-119991 * Author: swebb (Steven Webb) * Status: Closed * ruby -v: 4.0.9 * Backport: 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ---------------------------------------- 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 '
' ``` 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. -- 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/lists/ruby-core.ml.ruby-lang.org/