[Vm-dev] Re: [Pharo-dev] Array literal changes of a compiled
method
Eliot Miranda
eliot.miranda at gmail.com
Mon Sep 21 15:41:45 UTC 2015
Hi Stef,
On Sun, Sep 20, 2015 at 11:51 AM, stepharo <stepharo at free.fr> wrote:
>
> Hi eliot
>
> I thought that with Spur we could start to take advantages of the
> immutability bit. Now what is special with literals?
> We could have ImmutableString ImmutableSymbol? (I know that immutability
> is the instance level but may be the class should get impacted too).
>
In my experience the special class approach doesn't work well. I tried it
with BrouHaHa way back in the 80's; the BrouHaHa VM didn't support
immutability, but one could make immutable literals rather like Symbol
being almost immutable now. Instead, the compiler simply uses the
immutability bit to mark the literals in a method as immutable, and just
uses the normal classes for literals. This is the approach we took in
VisualWorks and it works well.
But note that code that wants to use literals as the starting point for
building a mutable collection, e.g.
(WriteStream on: 'Name: ') setToEnd; nextPutAll: name
needs to be rewritten (with either scheme) as e.g.
(WriteStream on: 'Name: ' copy) setToEnd; nextPutAll: name
Stef
>
--
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20150921/06b122af/attachment.htm
More information about the Vm-dev
mailing list