immutability and become (Was: Re: [squeak-dev] immutability)

Igor Stasenko siguctua at gmail.com
Thu Mar 18 04:15:25 UTC 2010


As well, as i could simply do:

object isMutable ifFalse: [ object becomeForward: object clone ].

And so, #become becomes a universal tool to defeat an immutability.

On 18 March 2010 06:00, Igor Stasenko <siguctua at gmail.com> wrote:
> Yes, i am against adding immutability bit in VM.
>
> But if we going that way, then please explain me how VM will respect
> immutability and #become: or #becomeForward:
> at the same time.
>
> The problem is following:
> suppose your object (a) is referencing object (b).
>
> now you doing:
>  a beImmutable.
>
> and then
>
> b becomeForward: c.
>
> which leads to replacement of reference to (b) by reference to (c)
> in an object (a), which is immutable.
>
> You could say, lets ignore this.
> Then, apparently , expect to see a hacky code, which as a workaround
> of immutability, using #become..
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list