[Vm-dev] Questions related to immutability in Cog

Eliot Miranda eliot.miranda at gmail.com
Mon Nov 16 17:39:22 UTC 2015

Hi Tim,

On Wed, Nov 11, 2015 at 10:30 AM, tim Rowledge <tim at rowledge.org> wrote:

> > On 11-11-2015, at 7:47 AM, Chris Cunningham <cunningham.cb at gmail.com>
> wrote:
> >
> >  immutablity - an immutable bitblit?
> exactly what I was thinking :-)
> A couple of other immutability thoughts;
> copying an imm. (I refuse to type it out every time) object - the copy
> primitive would need to clear the imm. bit unless we declare that a copy is
> also imm. In which case only ST code copying could be used to make non-imm.
> copies.
> we’re SOL anytime any external prim or call is passed the guts of an imm.
> object.

It is most important that the copy of an immutable object is /not/
immutable because otherwise its extremely clumsy to use immutable
literals.  For example where you see

    WriteStream on: ''

(which is of course a bug) this will no loner work with immutable literals
and needs to be rewritten.  If copy yields a mutable object were can write

    WriteStream on: '' copy

Chris, BitBlt should /fail/ if it attempts to write into an immutable
destination.  Just because it's BitBlt doesn't give it the right to write
to a read-only object, right?

> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> A hacker does for love what others would not do for money.

best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20151116/789bd0a8/attachment.htm

More information about the Vm-dev mailing list