I’m curious what will the OP is going to respond.
Guy Arad

Yes, that is a simple case — in fact you get away with it because you need no synchronisation involving side effects. Things get more complicated when you involve IO, for example. I have seen Haskell deal with this kind of situations, and it is not done by the compiler. Programmers have to deal with it, and they typically do so using structures that abstract — i.e., hide—away synchronisation altogether, even though it is still very much there. All I’m saying is that reality is far more complicated than toy examples, and the OP did not only hand-wave his way out of a tricky situation by using a toy example, he also did not even explain how things work out in said toy example. Very poor writing.