It\'s often mooted (indeed I think even the standard alludes to it), that a @= b
and a = a @ b
are equivalent. Here I\'m using @
to stand
The built-in operators have that equivalence, except that a @= b
only evaluates a
once, while a = a @ b
evaluates it twice.
However, these are not the built-in operators, but overloads provided by the standard library. They are treated as separate, unrelated functions, so the compiler cannot change one into the other. (In fact, as noted in the comments, only the assignment operators are overloaded for atomic types - you would have to explicitly load and store the value to use the non-atomic form).