Hey,
I understand why mutating instance variables is a bad thing.
But what about mutating state inside a function? To my knowledge, variables inside the function are allocated in the stack and not in the heap, therefore they are not objects of any concurrency issue.
Scala and other functional languages say
you should not mutate any state. Why it is so?