-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
Destructure more complicated data structures #226
Comments
However, not just enums are important. Another useful case would be to destructure an array inside Maybe.
|
I can take it |
@gdotdesign Could you help me a bit?
|
The What is missing is that since |
That worked out |
Trying to pick this back up. Will be taking from #283 |
One problem that I'm not sure of a good way to solve right now is how to make sure that nested destructuring of non-tuples doesn't happen outside of a case statements. The problem I'm thinking of is trying to destructure an Enum inside of a tuple. In the parsing level, the compiler would have to know that it can be a tuple destructuring but only other tuple destructurings can be in it and not other types of destructuring.
What do you think? |
I think this can be solved by having an argument for the def tuple_destructuring(only_tuples_inside = false) : Ast::TupleDestructuring? and then later on: if only_tuples_inside
tuple_destructuring(only_tuples_inside) || variable
else
tuple_destructuring(only_tuples_inside) || variable || enum_destructuring
end |
Let's examine this ugly function:
I would like to destructure tuple of 2 Maybes containing enums and directly access internal values of those enums.
Currently even a Tuple of built-in types is not destructurable.
The text was updated successfully, but these errors were encountered: