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

Destructuring assignment #1073

Open
8 of 10 tasks
degory opened this issue Feb 19, 2024 · 0 comments
Open
8 of 10 tasks

Destructuring assignment #1073

degory opened this issue Feb 19, 2024 · 0 comments

Comments

@degory
Copy link
Owner

degory commented Feb 19, 2024

Add support for destructuring assignment from tuples both for assignment statements and for variable initializers of let statements.

Even non-recursive destructuring of a single tuple into a flat list of variables would be very useful, but recursive destructuring is probably fairly easy to implement.

Destructuring of lists is probably less useful and is not a priority.

We should support placeholders for values we want to discard, e.g. _

Destructuring from:

  • ValueTuple<T0, T1, T2, ...>
  • By naming convention `0, `1 , `2, ...
  • By deconstruct(e0: T0 ref, e1: T1 ref, e2: T2 ref, ...)

Destructuring into:

  • flat parentheses delimited lists of variables in assignments
  • flat parentheses delimited lists of variables in let statement variable initializers
  • flat parentheses delimited lists of variables in for statement variable initializers
  • nested parentheses delimited lists of variables in assignments
  • nested parentheses delimited lists of variables in let statement variable initializers
  • nested parentheses delimited lists of variables in for statement variable initializers

Placeholders:

  • Ignore source values that map to the placeholder variable name _ on the left hand side of assignments and initializers
degory added a commit that referenced this issue Mar 10, 2024
Enhancements:
- Destructuring assignment and variable initialization from tuples (see #1073)
- Remove deprecated var statement
degory added a commit that referenced this issue Mar 10, 2024
Enhancements:
- Destructuring assignment and variable initialization from tuples (see #1073)
- Remove deprecated var statement
degory added a commit that referenced this issue Mar 12, 2024
Enhancements:
- Destructure non-tuple values by field naming convention (see #1073)
- Public fields (see #1110)

Technical:
- Optionally emit boilerplate IL assembly language from a file specified in a command line argument
degory added a commit that referenced this issue Mar 12, 2024
Enhancements:
- Destructure non-tuple values by field naming convention (see #1073)
- Public fields (see #1110)

Technical:
- Support emitting boilerplate IL assembly language from a file specified in a command line argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant