How to pattern match mutable fields inside object?

How can I pattern match the mutable fields of an object in Motoko like the commented out lines in the following REPL?


1 Like

The short answer is that you can’t at the moment.

One could allow this but then there is the question of whether you just want to bind the location, allow pattern matching on the current value in that location, or both.

We also don’t have array patterns at the moment, which present similar issues.

I can’t really follow what that means :smiley: do you maybe have an example? Why does this ambiguity not appear for immutable types?