[ruby-core:120794] [Ruby master Bug#21089] Missing methods on enumerators created from Enumerator::product and Enumerator::Chain

Issue #21089 has been reported by zetter (Chris Zetter). ---------------------------------------- Bug #21089: Missing methods on enumerators created from Enumerator::product and Enumerator::Chain https://bugs.ruby-lang.org/issues/21089 * Author: zetter (Chris Zetter) * Status: Open * ruby -v: ruby 3.5.0dev (2025-01-26T08:52:22Z master d4a1a2780c) +PRISM [arm64-darwin24] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- I was using `Enumerator.product` and noticed the enumerators it returned were missing the `next` method. When looking at the source code, I saw all the stateful enumerator methods were missing (`next`, `peek_values`, `peek`, `next_values`, `feed`) as they were removed from the `Enumerator::Product` subclass with `rb_undef_method`. This also applies to instances of `Enumerator::Chain`, it looks like the methods never worked and were removed in https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/68d... Because the English documentation says `Enumerator.product` 'Generates a new enumerator object' and the documentation says it inherits from `Enumerator` I expected it to have the `next` method available. I can use `.to_enum` to make the next method available, but I'm not sure why I need to. I'm unsure if this could be solved by making these available or the documentation could be improved. -- https://bugs.ruby-lang.org/

Issue #21089 has been updated by nobu (Nobuyoshi Nakada). Assignee set to knu (Akinori MUSHA) ---------------------------------------- Bug #21089: Missing methods on enumerators created from Enumerator::product and Enumerator::Chain https://bugs.ruby-lang.org/issues/21089#change-111664 * Author: zetter (Chris Zetter) * Status: Open * Assignee: knu (Akinori MUSHA) * ruby -v: ruby 3.5.0dev (2025-01-26T08:52:22Z master d4a1a2780c) +PRISM [arm64-darwin24] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- I was using `Enumerator.product` and noticed the enumerators it returned were missing the `next` method. When looking at the source code, I saw all the stateful enumerator methods were missing (`next`, `peek_values`, `peek`, `next_values`, `feed`) as they were removed from the `Enumerator::Product` subclass with `rb_undef_method`. This also applies to instances of `Enumerator::Chain`, it looks like the methods never worked and were removed in https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/68d... Because the English documentation says `Enumerator.product` 'Generates a new enumerator object' and the documentation says it inherits from `Enumerator` I expected it to have the `next` method available. I can use `.to_enum` to make the next method available, but I'm not sure why I need to. I'm unsure if this could be solved by making these available or the documentation could be improved. -- https://bugs.ruby-lang.org/
participants (2)
-
nobu (Nobuyoshi Nakada)
-
zetter (Chris Zetter)