Skip to content

Support multi-valued comprehensions (EEP-78)#125

Merged
sile merged 1 commit intomasterfrom
support-eep0078
Feb 12, 2026
Merged

Support multi-valued comprehensions (EEP-78)#125
sile merged 1 commit intomasterfrom
support-eep0078

Conversation

@sile
Copy link
Owner

@sile sile commented Feb 12, 2026

This PR implements support for multi-valued comprehensions as specified in EEP-78, allowing multiple elements to be emitted per iteration in list and map comprehensions.

Changes

  • components.rs: Add children() method for ComprehensionExpr<Open, Close, NonEmptyItems<Expr>> to iterate over all expression and qualifier children
  • lists.rs:
    • Update ListComprehensionExpr to use NonEmptyItems<Expr> to support multiple value expressions
    • Update documentation to reflect the new syntax [Expr, ...]
    • Add test cases for multi-valued list comprehensions
  • maps.rs:
    • Update MapComprehensionExpr to use NonEmptyItems<MapComprehensionValue> for multiple entries per iteration
    • Implement children() method for map comprehensions that flattens multiple key-value pairs
    • Update documentation and add test cases for multi-valued map comprehensions

These changes enable syntax like [X, Y || X <- Xs, Y <- Ys] and #{K1 => V1, K2 => V2 || ...} while maintaining backwards compatibility with single-valued comprehensions.

@sile sile merged commit c348475 into master Feb 12, 2026
8 checks passed
@sile sile deleted the support-eep0078 branch February 12, 2026 23:19
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