[Vm-dev] [Pharo-dev] Array literal changes of a compiled method

stephane ducasse stephane.ducasse at gmail.com
Mon Sep 21 18:54:10 UTC 2015


I see. 
I was proposing to a guy for his phd topic that he could play with immutable structures. 
But we will see if he will get a grant. 
Stef

On 21 Sep 2015, at 15:41, Eliot Miranda <eliot.miranda at gmail.com> wrote:

> 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/0c22c79e/attachment.htm


More information about the Vm-dev mailing list