<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>
</div>
<div>Or am I missing something?<br> </div>
<div><span class="gmail_quote">On 10/2/08, <b class="gmail_sendername">Randal L. Schwartz</b> <<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 <<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. 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. 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. (*Any* method can call a primitive.)<br><br>--<br>Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095<br><<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>> <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>