[enhancement][dslx] Struct destructuring similar to Rust
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
### What's hard to do? (limit 100 words)
See https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html#destructuring-structs
It'd be nice to pattern match structs similar to record-style pattern matching in ML family of languages, Rust does it similar to this:
` let Point { x, y } = p;`
### Current best alternative workaround (limit 100 words)
Just access the struct fields out individually, or make a "tuplifier" helper function and destructure into tuple names.
### Your view of the "best case XLS enhancement" (limit 100 words)
We could pattern match irrefutably for e.g. let statements and we could pattern match refutably for e.g. match statements, with the same syntax as Rust shown above.
Contributor guide
Assessment
This issue has not been assessed yet.