Changing strings
Jon Hylands
jon at huv.com
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
string
>literal is, then the user can change the value of that instance
variable
>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...
Later,
Jon
--------------------------------------------------------------
Jon Hylands Jon at huv.com http://www.huv.com/jon
Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
http://www.huv.com
More information about the Squeak-dev
mailing list
|