Changing strings

Jon Hylands jon at
Sun Apr 21 23:41:14 UTC 2002

At Sunday, 21 April 2002, you wrote:

>returns false, so I guess it may not be a problem very often.  
>Nonetheless, I find it disturbing that if a an instance variable is 
>initialized using a string literal, and if a user knows what that 
>literal is, then the user can change the value of that instance 
>without an accessor.

No, actually, they can't (at least, not using the technique you're 
talking about). The string literal is only the same object within 
the context of a single method compilation (or a single "Doit", which 
is the same thing).

>Any comments?

Well, as a general Smalltalk practice, I try and avoid destructively 
modifying strings whenever possible. Its almost never necessary to 
do that...


   Jon Hylands      Jon at

  Project: Micro Seeker (Micro Autonomous Underwater Vehicle)

More information about the Squeak-dev mailing list