From: "swebb (Steven Webb) via ruby-core" Date: 2026-10-24T14:11:29+00:00 Subject: [ruby-core:127229] [Ruby Bug#22470] Array#find and Array#rfind arity change between versions 3 and 4 Issue #22470 has been updated by swebb (Steven Webb). https://github.com/ruby/ruby/pull/19516 ---------------------------------------- Bug #22470: Array#find and Array#rfind arity change between versions 3 and 4 https://bugs.ruby-lang.org/issues/22470#change-119644 * Author: swebb (Steven Webb) * Status: Open * ruby -v: 4.0.9 * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- 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/