[squeak-dev] Immutability (was Re: About String vs Symbols)
Janko Mivšek
janko.mivsek at eranova.si
Tue Jul 29 20:03:36 UTC 2008
Hi Eliot,
Does that mean that you are introducing immutability in new Squeak VM
you are working on? Well, that would be really nice!
Janko
Eliot Miranda wrote:
>
>
> On Tue, Jul 29, 2008 at 9:21 AM, stephane ducasse
> <stephane.ducasse at free.fr <mailto:stephane.ducasse at free.fr>> wrote:
>
> Hello
>
> I'm reading newspeak spec and I like the idea of immutable strings.
> Now what does it really bring to us?
>
>
> Safety. One can no longer overwrite literals or methods (or anything
> else whose state you want to protect) accidentally.
>
> Expressive power. One can use immutability as a write barrier in
> orthogonal persistence or distribution schemes (and other things) . One
> marks an object as immutable to indicate that it is persistent or
> distributed and its changes should be exported. The immutability scheme
> allows one to associate managers for specific objects that
> handle NoModificationErrors on a per-object basis. So if an object is
> immutable and has an appropriate manager that manager can temporarily
> enable immutablity for the object, allow the modification, communicate
> the modification (e.g. to a database or remote image) and then re-enable
> immutability. The framework allows an object to have multiple managers.
> (This is all standard Squeak and very similar to the code I wrote for
> VW. The VM code is also available from Cadence).
>
> Then does it mean that we could get rid of symbols
> immutability does not imply unique identity.
>
>
> No. As you point out Symbols are unique and so immutable strings don't
> replace them. But it is nice to have immutable Symbols. e.g. try to do
> this in your Squeak image:
> #class pvtAt: 1 put: 0 asCharacter
> Scary :)
>
>
>
> Stef
>
>
>
> ------------------------------------------------------------------------
>
>
--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
More information about the Squeak-dev
mailing list
|