It used to be the case that this kind of code woud work fine in Cincom Smalltalk:
'foo bar' at: 5 put: $f
The problem is that the string 'foo bar' is a literal, and allowing it to be modified can introduce subtle - and hard to find - bugs into an application. Back in VW 7, we made literal objects in Smalltalk immutable. However, any change of this nature can cause problems for older code that relied on the former, mutable state of literals.
So, on today's Smalltalk Daily, I go over how to deal with this. As I bring up numerous times in the screencast, you shouldn't make literals mutable because you can; you should use the capabilities here mostly (or only, even) with legacy code situations.
Technorati Tags:
smalltalk, immutable literals