Destructure object into mutable assignment target

How can I destructure the object that’s returned in line 26 into a mutable assignment target?
What I basically want to do is

{ counterState } := _Counter.toStable();

@claudio @diegop

I’m afraid you can’t. Pattern matching can only bind new identifiers, it cannot assign.

(I know this is something you do in JavaScript, but it is a super hacky feature. Among other things, it makes the order in which a pattern match proceeds observable.)


Any elegant way around this if the identifiers share the same name?

Not sure which identifiers you mean, but generally, the choice of names does not have any affect on semantics.

1 Like