<div dir="ltr"><br><br><div class="gmail_quote">On Thu, Oct 2, 2008 at 6:17 PM, Sean Allen <span dir="ltr">&lt;<a href="mailto:sean@monkeysnatchbanana.com">sean@monkeysnatchbanana.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div class="Ih2E3d">You&#39;d have to specially code each accessor in that case to check the flag.</div></div></blockquote><div><br>Yes. This is unlikely to be a problem unless you have a lot of members.<br>
<br>Alternatively you could adapt the code that generates your accessors to put in that check, or you could use/adapt magritte to generate your objects.<br>&nbsp;<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div class="Ih2E3d"><div><br></div><div>Ideally I&#39;d like to be able to step in front of every message send to descendent objects and</div><div>decide whether to pass along ( read call ) or reject ( write call ).</div>
<div><br></div><div>then, all the logic is in one place and the accessors don&#39;t need to know about what is going on.</div><div><br></div><div>any way to do that?</div><div><br></div></div><div class="Ih2E3d"><div>i&#39;m ok with the primitive problem as i don&#39;t need real immutability. just &#39;application level&#39; immutability...</div>
<div>ideally, without special coding in every accessor method ( that would get tedious very quickly ).</div><div><br></div></div><div><br><div><div class="Ih2E3d"><div>On Oct 2, 2008, at 12:47 PM, Marcin Tustin wrote:</div>
<br></div><div><div></div><div class="Wj3C7c"><blockquote type="cite"><div>Surely if you have a wrapper class which only holds a reference to a single object that has all of the data, and that has accessors, then the wrapper can only use the accessors? The data object could have a flag that causes all of the accessors to throw an exception when it is set. <br>
 &nbsp;</div> <div>Or am&nbsp;I missing something?<br>&nbsp;</div> <div><span class="gmail_quote">On 10/2/08, <b class="gmail_sendername">Randal L. Schwartz</b> &lt;<a href="mailto:merlyn@stonehenge.com" target="_blank">merlyn@stonehenge.com</a>&gt; wrote:</span> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
&gt;&gt;&gt;&gt;&gt; &quot;Sean&quot; == Sean Allen &lt;<a href="mailto:sean@monkeysnatchbanana.com" target="_blank">sean@monkeysnatchbanana.com</a>&gt; writes:<br> <br>Sean&gt; If you wanted to take a mutable object and make it immutable and be able<br>
Sean&gt; to go back again to mutable, how could you do that?<br><br>Squeak doesn&#39;t have that sort of capability.&nbsp;&nbsp;The immutability of a few<br> classes is because the VM recognizes them specially, and not available<br>
at the programmer level without modifying the VM.<br><br>Other Smalltalk VMs are different.&nbsp;&nbsp;I think both VisualWorks and GemStone/S<br>have primitive bits on an object to be informed when a mutation might be<br> attempted.<br>
<br>You can simulate that *mostly* in Squeak by using a &quot;proxy&quot; object that<br>intercepts all messages and looks for the dangerous ones, but that&#39;s gonna be<br>a bit hard to do, and won&#39;t be aware of any new code that might call the<br>
 mutating primitives directly.&nbsp;&nbsp;(*Any* method can call a primitive.)<br><br>--<br>Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095<br>&lt;<a href="mailto:merlyn@stonehenge.com" target="_blank">merlyn@stonehenge.com</a>&gt; &lt;URL:<a href="http://www.stonehenge.com/merlyn/" target="_blank">http://www.stonehenge.com/merlyn/</a>&gt;<br>
 Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.<br>See <a href="http://methodsandmessages.vox.com/" target="_blank">http://methodsandmessages.vox.com/</a> for Smalltalk and Seaside discussion<br>_______________________________________________<br>
 Beginners mailing list<br><a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
 </blockquote></div><br> _______________________________________________<br>Beginners mailing list<br><a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
</blockquote></div></div></div><br></div></div><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>