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

Spec and implement new tuple syntax and tuples with named fields #137

Closed
mohammadfawaz opened this issue Jul 27, 2023 · 0 comments · Fixed by #138
Closed

Spec and implement new tuple syntax and tuples with named fields #137

mohammadfawaz opened this issue Jul 27, 2023 · 0 comments · Fixed by #138
Assignees
Labels

Comments

@mohammadfawaz
Copy link
Contributor

mohammadfawaz commented Jul 27, 2023

As discussed during the design meeting:

  • New tuple expression and type syntax: let t: { int, int, real } = {5, 6, 7.0 };
  • Tuple index expressions remain the same
  • Tuples can have named fields: let t: { x: int, y: int, z: real } = {5, 6, 7.0 };
  • Tuples with named fields can be accessed in two ways: either via the field index: e.g. t.1, or via the field name: t.y.
  • Tuple fields can be initialized with or without names. e.g. let t: { x: int, y: int, z: real } = { x: 5, y: 6, 7.0 };
  • Tuple fields can only be initialized out of order if:
    • All tuple fields are named fields.
    • All tuple fields are initialized with their names.
@mohammadfawaz mohammadfawaz self-assigned this Jul 27, 2023
@mohammadfawaz mohammadfawaz changed the title New tuple syntax and named tuples Spec and implement new tuple syntax and tuples with named fields Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant