Outside of threading, what type of "contexts" are there which could "share objects" with a risk that one of them might change it without it being a deliberate act on the part of the programmer to do so?
Different lexical scopes, different libraries where you don't know how well they are programmed etc.
You are basically saying that every object should be immutable
Not at all. Please stop laying words in my mouth that I didn't utter.
I'm saying that immutability can be beneficial. Of course it also comes at a cost, so it's a tradeoff. As always.
In reply to Re^5: The fallacy of the *requirement* for read-only instance variables.
by moritz
in thread The fallacy of the *requirement* for read-only instance variables.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |