<html>
    <head />
        <body>
            <br /> <blockquote type="cite">On 13 June 2012 09:41, Bert Freudenberg &lt;bert@freudenbergs.de&gt; wrote:<br />&gt;<br />&gt; On 2012-06-13, at 05:27, Igor Stasenko wrote:<br />&gt;<br />&gt;&gt; Another (open) question, is how to deal with immutability in presence<br />&gt;&gt; of &nbsp;become, i.e.:<br />&gt;&gt;<br />&gt;&gt; mutableCopy := immutableObject shallowCopy.<br />&gt;&gt; immutableObject becomeForward: mutableCopy.<br />&gt;&gt;<br />&gt;&gt; such kind of things making immutability useless for protecting some<br />&gt;&gt; critical parts of object memory,<br />&gt;&gt; like preventing modification of compiled method literals:<br />&gt;&gt; &nbsp;yes you cannot change the immutable object, but you can replace all<br />&gt;&gt; pointers to it with it's own mutable copy, which is equivalent to<br />&gt;&gt; making it mutable again.<br />&gt;<br />&gt;<br />&gt; Why should the VM allow become of an immutable object?<br />&gt;<br /><br />You can disallow this. But you can only make it harder: i can do it<br />manually - take all objects pointing to immutable one and replace the<br />pointer to it with it's mutable copy. And it is completely legal,<br />except that it will be a bit harder, since done not by primitive.</blockquote><br />You are confusing something here. Become is just a &quot;fancier form&quot; of  assignment that you could in fact write without a primitive by  enumerating all the references to an object. If you keep that in mind it  is obvious that since assigning an immutable *to* a variable is never a  problem using become *with* an immutable as argument is neither since  in both cases the immutable remains immutable.<br /> <br /> The real question that arises is whether become should be allowed to  change the *contents* of an immutable object. Personally, I think it  should not, but this has some side effects that require fixing such as  class migration which really should have a separate primitive to update  its instances after reshape - the rules for this *should* include  changing immutables unless you want to change the system to deal with  multiple concurrent class versions (much pain down that path).<br /> <br /><blockquote type="cite">Disallowing #become on immutables raising many additional questions:<br /><br />what is your action when you need to migrate instances of a class due<br />to it's reshaping, while some of them are immutable?</blockquote><br />Class migration should really have its own primitive. If it had, much pain could be avoided in migrating classes (see comments in ClassBuilder&gt;&gt;update:to:). And then one could decide on the proper policy to use for immutables.<br /><br />Cheers,<br />&nbsp; - Andreas<br /><br /><blockquote type="cite"><br />(I bet there is be many other examples, when this will break existing<br />traditional schemes, like working<br />with proxies etc).<br /><br />I don't wanna spread FUD.. just want to make sure that we ready to<br />answer for every such question.<br /><br /><br />&gt; - Bert -<br /><br />-- <br />Best regards,<br />Igor Stasenko.<br /></blockquote>
        <div class="signature"><br /><br /><br />-- <br />Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir<br />belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de</div></body>
    </html>