"Lukas Renggli" renggli@gmail.com writes:
Also, FWIW, if you like the ANSI version, it is easy to implement. Here is a version using a dead forked dialect of Squeak; it should be easy to dust it off should anyone want. This version goes further than discussed in this thread, and even makes floats and large integers be immutable. :) The code is in islands.zip on the following page; look inside the zip for immutLits1.5.cs and immutLits2.2.cs.
In 3.8 and 3.9 there are 5 subclasses of String (Symbol, Byte and Wide) and many more for ArrayedCollection. Your change would introduce many read-only classes and lead to much duplicated code (ok, traits would be a big help here).
Immutability should be an instance-level property and not special class.
Good point, there was just one String back then so it was simpler.
Still, there should be a reasonable way to engineer this at the image level. Smalltalk is a pretty cool language. :) And adding immutable strings and arrays, should be easier than adding a generic immutability system.
A generic immutability system would be cool, though. You could catch some bugs with it.
-Lex