<br><br><div><span class="gmail_quote">On 9/19/07, <b class="gmail_sendername">Brad Fuller</b> &lt;<a href="mailto:bradallenfuller@yahoo.com">bradallenfuller@yahoo.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Is there a way to override an instance method w/o subclassing?<br>For instance, class Morph has a method that returns true, but I want the that<br>method to return false when instancing some types of Morphs and others not.
<br>(there is no setter/getter for this method.) Is there a way to do that w/o<br>adding a setter/getter to Morph or subclassing the different Morphs?<br><br></blockquote></div><br>Er... my immediate suspicion is that you&#39;d want to take a step back and ask yourself /why/ you&#39;re doing this.
<br><br>There is some black magic you can do to achieve this hackery, but beware, this is very powerful magic and many images have been killed in its making.<br><br>Before you run your test, save your image. Do not save your image after running your test; instead, trash the image and start it up again from your save.
<br><br>Install this: <a href="http://www.squeaksource.com/DPON/MessageCapture-mvdg.9.mcz">http://www.squeaksource.com/DPON/MessageCapture-mvdg.9.mcz</a>, try to understand it and let me know if you can&#39;t understand my comments.
<br><br>Set up message capture on the Morph you want. Implement a message handler to do the logic you need for one set of clients and give them the MessageCapture object. Give the original Morph to the other objects.<br><br>
Good luck! And remember - don&#39;t save your image after you run this until you&#39;re sure it works. The debugger and inspector will crash the image if you try to use them.<br><br>Another way would be to inspect thisContext to see who the sender is and do conditional logic that way.
<br><br>Regards,<br>Gulik.<br>