Can't destructure in Markup
edward-shen opened this issue · comments
Edward Shen commented
Hey!
I'm trying to destructure an struct in a markup parameter:
Foo(Bar {x, y, z}: Bar) {
p { {x} }
}
But the compiler's expecting an :
where the destructure is occuring.
For reference, I can do this in a normal function:
fn Foo(Bar {x, y, z}: Bar) { // ... }
Is this a bug or an unsupported feature?
Edward Shen commented
I guess a simple workaround would be to destructure at the next available level, but I think this would be a great feature to add, if it's not a feature yet!
Utkarsh Kukreti commented
This is because markup creates a struct for the arguments. If you use a pattern on the left side, there's no way to know what the struct field should be called.
Utkarsh Kukreti commented
Closing as resolved. If you have any other questions, feel free to ask.