string sharing (possible bug?)

Bill Felton bfelton at ibm.net
Wed Dec 9 17:20:59 UTC 1998


Hi Adam,
Yup, Smalltalkers are a great crew, always ready to help.  One of
the many things that first attracted me to this technology years
ago was the overall high quality of the people involved.

I have to take (minor) issue with your assertion that it would be
a good thing if literals could not be modified.  This causes nearly
as many problems as it solves, sadly.  Its one of those ideas
that sounds so good (like making browsers auto-update when code
changes are accepted elsewhere) that can turn around and bite you.

My preference would be to see a way to distinguish two kinds of
literals -- read only and read/write.  Of course, given the general
perversity of things, this would also probably have drawbacks.
There may not be a clear clean universal win available on this one...

Just my $0.02 worth  ;->

Bill

At 11:30 AM 12/9/98 -0500, you wrote:
>Thank you very much to everyone who answered this question.  I'm amazed, I
>just asked this question half an hour ago and got three replies already.
>
>To summarize the answers:  Yes, Smalltalk does arrange to share literals at
>the method level, so the behaviour I noticed was correct.  And yes, it is a
>good idea not to modify objects created from literals, but instead to make a
>copy of them if they might be modified.  In fact it would probably be a good
>idea if the Smalltalk system itself didn't allow literals to be modified.
>Someone pointed out that VisualAge does just that.
>
>Thanks again,
>Adam
>
>
>





More information about the Squeak-dev mailing list