Why are destructuring declarations only allowed for local variables/values?

I get this error when trying to use destructuring declarations for class properties:

Destructuring declarations are only allowed for local variables/values

So why is it like this? I think destructuring declarations for member and top-level variables are quite pratical. Scala supports pattern matching for members and it doesn’t cause any problems.

1 Like