Immutable strings (was: Re: Very strange bug on Streams and probably compiler)

Lukas Renggli renggli at gmail.com
Wed Mar 7 20:52:10 UTC 2007


> However, it is *utterly* trivial to implement a subclass of String (call
> it "ImmutableString") that delegates the subclass responsibilities of
> String to an iVar and simply raises errors when trying to access them
> via #at:put: and friends. Then you simply implement
> String>>asImmutableString properly (^ImmutableString on: self) and off
> ya go!

Certainly that will work for String's in 3.7. In 3.8 there is also
ByteString and WideString. Futhermore you would probably also need
immutabilty for other instances like LargeInteger's, Float's, Array's
and maybe some other classes.

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch



More information about the Squeak-dev mailing list