<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">You'd have to specially code each accessor in that case to check the flag.<div><br></div><div>Ideally I'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't need to know about what is going on.</div><div><br></div><div>any way to do that?</div><div><br></div><div>i'm ok with the primitive problem as i don't need real immutability. just 'application level' immutability...</div><div>ideally, without special coding in every accessor method ( that would get tedious very quickly ).</div><div><br></div><div><br><div><div>On Oct 2, 2008, at 12:47 PM, Marcin Tustin wrote:</div><br class="Apple-interchange-newline"><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">merlyn@stonehenge.com</a>> wrote:</span> <blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">>>>>> "Sean" == Sean Allen &lt;<a href="mailto:sean@monkeysnatchbanana.com">sean@monkeysnatchbanana.com</a>> writes:<br> <br>Sean> If you wanted to take a mutable object and make it immutable and be able<br>Sean> to go back again to mutable, how could you do that?<br><br>Squeak doesn'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 "proxy" object that<br>intercepts all messages and looks for the dangerous ones, but that's gonna be<br>a bit hard to do, and won'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">merlyn@stonehenge.com</a>> &lt;URL:<a href="http://www.stonehenge.com/merlyn/">http://www.stonehenge.com/merlyn/</a>><br> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.<br>See <a href="http://methodsandmessages.vox.com/">http://methodsandmessages.vox.com/</a> for Smalltalk and Seaside discussion<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">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br> </blockquote></div><br> _______________________________________________<br>Beginners mailing list<br><a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br>http://lists.squeakfoundation.org/mailman/listinfo/beginners<br></blockquote></div><br></div></body></html>