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

Convert struct argument between pattern and object #11113

Closed
masklinn opened this issue Dec 24, 2021 · 4 comments
Closed

Convert struct argument between pattern and object #11113

masklinn opened this issue Dec 24, 2021 · 4 comments
Labels
A-assists C-feature Category: feature request S-actionable Someone could pick this issue up and work on it right now

Comments

@masklinn
Copy link

masklinn commented Dec 24, 2021

Some times manipulating a single object is useful, other times it's preferable / more convenient to explode the struct right at the parameter and manipulate its sub-components only.

Would be useful to have that built-in.

This might be part of a wider set of conversions around parameters e.g. "introduce parameter object" is a classic, in Rust it could be replacing multiple parameters by a single tuple or struct, and converting name to pattern (and pattern to name) could be a sibling assist.

@bjorn3 bjorn3 added A-assists C-feature Category: feature request S-actionable Someone could pick this issue up and work on it right now labels Dec 24, 2021
@Veykril
Copy link
Member

Veykril commented Dec 24, 2021

This is #8673 if I understand this correctly, right?

@masklinn
Copy link
Author

This is #8673 if I understand this correctly, right?

If #8673 is supposed to work for function parameters then yes, but also the inverse of #8673 where the tuple is "restructured" and the indirect accesses have to be reintroduced (the reverse is actually the one I was looking for but I figured an issue for both sides would make sense).

@Veykril
Copy link
Member

Veykril commented Dec 25, 2021

Yes #8673 is supposed to be applicable for all patterns, irrefutable and refutable.

The reverse idea hasn't come up yet though.

@masklinn
Copy link
Author

Ok i’ll close this and comment on the other one then (assuming I don’t forget), sorry for the bother.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists C-feature Category: feature request S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

3 participants