Skip to content

Specs for Enumerator::Lazy propagating source yield arity through stages - #1389

Open
sampokuokkanen wants to merge 1 commit into
ruby:masterfrom
sampokuokkanen:lazy-packed-propagation-specs
Open

Specs for Enumerator::Lazy propagating source yield arity through stages#1389
sampokuokkanen wants to merge 1 commit into
ruby:masterfrom
sampokuokkanen:lazy-packed-propagation-specs

Conversation

@sampokuokkanen

@sampokuokkanen sampokuokkanen commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

A lazy stage that passes its source values through unchanged keeps the arity they were yielded with, so a block belonging to a later stage still receives them the way a block on the first stage would. In CRuby this is the LAZY_MEMO_PACKED bit traveling along the chain; stages that replace the value with a block result clear it.

Covers take, drop, select, reject, take_while, drop_while, grep and grep_v through shared examples, plus the zero-argument yield (which becomes a single nil). uniq and compact drop values, so they get their own examples.

Also adds the existing :enumerable_value_packing examples to grep, the one Lazy method they did not already cover.

A lazy stage that passes its source values through unchanged keeps the arity
they were yielded with, so a block belonging to a later stage still receives
them the way a block on the first stage would. In CRuby this is the
LAZY_MEMO_PACKED bit traveling along the chain; stages that replace the value
with a block result clear it.

Covers take, drop, select, reject, take_while, drop_while, grep and grep_v through shared examples, plus the zero-argument yield (which becomes a single nil). uniq and compact drop values, so they get their own examples.

Also adds the existing :enumerable_value_packing examples to grep, the one
Lazy method they did not already cover.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant