Skip to content

Comments

Redesign stream as union and add streams.Enumerate (#908)#1042

Open
emil14 wants to merge 6 commits intomainfrom
codex/issue-908-stream-union
Open

Redesign stream as union and add streams.Enumerate (#908)#1042
emil14 wants to merge 6 commits intomainfrom
codex/issue-908-stream-union

Conversation

@emil14
Copy link
Collaborator

@emil14 emil14 commented Feb 24, 2026

Context

Implements core migration for #908 in scope of tracker #1033.

What is done

  • migrate stream<T> from struct to tagged union (Open | Data T | Close)
  • add parser/analyzer support for generic union literals in sender positions
  • migrate runtime stream funcs to Open/Data/Close protocol
  • add streams.Indexed<T>, streams.Enumerate<T>, streams.Just<T>
  • add runtime stream union helpers (IsData/IsClose/UnwrapData)
  • stabilize streams.ForEach via runtime controller (stream_for_each_controller) to preserve ordering and backpressure
  • fix streams.Filter event routing under union-stream semantics
  • remove implicit non-union->Data coercion in stream helper path

Verification

Passing:

  • go test ./internal/runtime/funcs ./examples/filter_list -count=1 -timeout 5m
  • go test ./examples/for_loop_over_list -count=1 -timeout 8m
  • go test ./examples/filter_list ./examples/for_loop_over_list -count=1 -timeout 9m

Note:

  • local golangci-lint binary in this environment is built with older Go (go1.25), so direct golangci-lint run ./... is blocked against target go1.26.0.

Refs #908
Refs #1033

@emil14 emil14 force-pushed the codex/issue-908-stream-union branch from cb7ebc0 to 5d9b918 Compare February 24, 2026 19:34
@emil14 emil14 force-pushed the codex/issue-908-stream-union branch from b22306f to c493af0 Compare February 25, 2026 08:35
@emil14 emil14 changed the title WIP: redesign stream as union and add streams.Enumerate (#908) Redesign stream as union and add streams.Enumerate (#908) Feb 25, 2026
@emil14 emil14 marked this pull request as ready for review February 25, 2026 08:48
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