From: "mame (Yusuke Endoh) via ruby-core" Date: 2025-02-11T13:04:59+00:00 Subject: [ruby-core:120937] [Ruby master Bug#21124] Enumerable#find called without a block returns Enumerator without size Issue #21124 has been updated by mame (Yusuke Endoh). Status changed from Feedback to Rejected Thanks for your confirmation. Closing. ---------------------------------------- Bug #21124: Enumerable#find called without a block returns Enumerator without size https://bugs.ruby-lang.org/issues/21124#change-111828 * Author: andrykonchin (Andrew Konchin) * Status: Rejected * ruby -v: 3.4.1 * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- When a collection's size is known then enumerator that iterates it usually has size (that's `#size` returns a collection size). But an enumerator returned by `Enumerable#find` called without a block doesn't have size: ```ruby [1, 2, 3].find.size # => nil ``` Expected result here is `3`. Usually similar methods in the Enumerable module return enumerators with size (when these enumerators for instance iterate the collection itself): ```ruby [1, 2, 3].each_entry.size # => 3 ``` -- 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/