<div dir="ltr"><div style="color:rgb(51,51,255);display:inline" class="gmail_default">T</div><div style="color:rgb(51,51,255);display:inline" class="gmail_default">hanks Bob! the example helped a lot.</div><div><font color="#3333ff"><br>
</font><div><div style="display:inline" class="gmail_default"><font color="#3333ff">Tim, i want to change the behavior of some methods (at runtime, based on the user&#39;s decision).</font></div></div><div><div style="color:rgb(51,51,255);display:inline" class="gmail_default">
for example, if a method of class A contains the comment:<br>&quot;hello, this is a comment&quot;</div></div><div><div style="color:rgb(51,51,255);display:inline" class="gmail_default">than if B inherits from A, this method wouldn&#39;t be inherited (an attempt to call this method from an object of type B would cause an exception to be thrown).</div>
</div></div><div><div style="color:rgb(51,51,255);display:inline" class="gmail_default">the reason i&#39;m using a comment is that it doesn&#39;t affect the code.</div></div><div><div style="color:rgb(51,51,255);display:inline" class="gmail_default">
<br></div></div><div><div style="color:rgb(51,51,255);display:inline" class="gmail_default">is there a simple way to add a code to a method?</div></div><div><div style="color:rgb(51,51,255);display:inline" class="gmail_default">
for example, to add &quot;this is a comment&quot; to the end of the code?</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 29, 2013 at 2:46 AM, tim Rowledge <span dir="ltr">&lt;<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On 28-04-2013, at 1:55 PM, Dvir Faivel &lt;<a href="mailto:sdvirf@t2.technion.ac.il">sdvirf@t2.technion.ac.il</a>&gt; wrote:<br>
<br>
&gt; hi there,<br>
&gt; i have a question about squeak object model.<br>
&gt;<br>
&gt; how can i check whether a method contains a certain piece of code?<br>
<br>
</div>You&#39;ll get better advice if you expand upon what you want &amp; why; what is the real problem you are trying to solve here?<br>
<br>
If, for example you&#39;re simply wanting to programatically find all senders of a particular message then the code is already there -<br>
take a look at SystemNavigation&gt;allCallsOn:fromBehaviors:sorted: to see how to scan all the methods implemented by a list of behaviours (ie classes or metaclasses) for sends of a particular message, including ones that are special cases.<br>

If you already know which class and method you want to look at then examine Behavior&gt;whichSelectorsReferTo:specialByte:thorough: to see how the system does it.<br>
<br>
Or are you wanting to look for particular fragments of code with some sort of text based pattern matching? Or…?<br>
<br>
<br>
tim<br>
--<br>
tim Rowledge; <a href="mailto:tim@rowledge.org">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" target="_blank">http://www.rowledge.org/tim</a><br>
ASCII to  ASCII, DOS to DOS.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
************************************************************************************<br>
This footnote confirms that this email message has been scanned by<br>
PineApp Mail-SeCure for the presence of malicious code, vandals &amp; computer viruses.<br>
************************************************************************************<br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div>