Skip to content

-mm=own: the lazy iterator helpers take their source over - #44

Merged
ASDAlexander77 merged 1 commit into
mainfrom
own-lazy-iterator-helpers
Oct 27, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
own-lazy-iterator-helpers

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

The lazy iterator helpers take their source over, as in JavaScript. Under -mm=own:

  • take, filter and map say @keeps("iter"); filter and map also keep callbackFn. The generator's state owns them, so const seq = fib().map(f) can be stored or returned.
  • drop returned iter itself. It is now a @keeps generator that skips limit values.

Depends on ASDAlexander77/TypeScriptCompiler#699 (@keeps on a generator). Merge that first.

Tests

  • With the compiler from #699:
    • The DefaultLib suites pass every test under rc, gc and none.
    • own goes from 137 to 139/170: iterator_map and iterator_filter now pass, with no new failures.
  • Still failing under own:
    • iterator_take and iterator_drop, on their Set values() lines: a temporary Set dies while the values() state borrows it.
    • iterator_reduce, on its string accumulator.

🤖 Generated with Claude Code

take, filter and map say @keeps, and drop becomes a @keeps generator, so under -mm=own the
generator's state owns the iterator (and the callback) and the result can be stored or returned.
Needs the compiler's @keeps on generators.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 8557525 into main Oct 27, 2026
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