The simplest version of this I can come up with is this:
-
Assignment changes which object a name refers to:
x = ex
causes the namex
to refer to the value resulting from the evaluation of the expressionex
. Assignment never changes the values of any objects. -
Mutation changes the value of an object:
x[i] = ex
andx.f = ex
both mutate the object referred to byx
changing a value at index or a property with a name, respectively. Mutation never changes what objects any names in any scope refer to.
Perhaps the confusion comes from the fact that these all use the =
in their syntax? They’re really totally unrelated. It’s also possible that people think of assignment as setting a named property on some implicit “scope object”. That’s probably a view that can be worked out coherently, in which case having a clear notion of what all the different “scope objects” are would be crucial but I’m not entirely sure if that’s a helpful way to think about the matter or not.