From: "shan (Shannon Skipper) via ruby-core" Date: 2024-03-07T18:03:13+00:00 Subject: [ruby-core:117079] [Ruby master Bug#20325] Enumerator.product.size bug with zero * infinite enumerators Issue #20325 has been updated by shan (Shannon Skipper). It seems like an infinite size with a `0` always has a product count of `0`. An infinite size preceding a `nil` has either a product count of `0` or infinity, but it's not lazily calculable so seems like it should be `nil`. ---------------------------------------- Bug #20325: Enumerator.product.size bug with zero * infinite enumerators https://bugs.ruby-lang.org/issues/20325#change-107153 * Author: marcandre (Marc-Andre Lafortune) * Status: Open * Target version: 3.4 * ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin22] * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- ``` ruby Enumerator.product([], 1..).to_a # => [] (OK) Enumerator.product([], 1..).size # => Infinity (Should be 0) ``` -- 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/postorius/lists/ruby-core.ml.ruby-lang.org/