Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lang: add basic unpacking for union types #110

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented Jan 25, 2025

Add the Match construct to the source language, which is used for accessing union elements.

A Match is an expression and must be exhaustive, with one and only one As handler present for each type in the union. Because borrowing and semantics for values aren't fully decided on at this point, the handlers always receive a copy of the union element, making it easier to change the semantics later on.


To-Do

  • wait for the testable meta-language-based source language definition to be available
  • define the semantics for Match
  • add tests for Match
  • write a proper commit message

Notes For Reviewers

  • I'm not set on Match and As -- suggestions for alternative names are welcome

Semantics are still missing.
A `Match` expression is translated directly into an L30 `Case`
statement.
@zerbina zerbina added the enhancement New feature or request label Jan 25, 2025
@zerbina zerbina mentioned this pull request Jan 25, 2025
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant