Please reply under posts. It makes things less confusing.<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
<div class="h5"><br>
<br>
On Jun 29, 2009, at 3:43 PM, David Goehrig wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What I typically what I&#39;ve been doing to eliminate all of these methods with a single simple change:<br>
<br>
Object<br>
   doesNoUnderstand: aMessage<br>
       ^ false<br>
</blockquote>
</div></div></blockquote><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div class="h5">On Tue, Jun 30, 2009 at 3:26 PM, Cameron Sanders <span dir="ltr">&lt;<a href="mailto:csanders.personal@functional-analyst.com">csanders.personal@functional-analyst.com</a>&gt;</span> wrote:<br>
What you write (down below) is close to what I was thinking when I said have all #isXXX return false by default;<br>
although I would test that the first two characters match &#39;i&#39; and &#39;s&#39;
and that more characters exist, if so, return false, otherwise, normal
#doesNotUnderstand: behavior.<br>
<br>
I would treat #is by itself differently... it is ... or it couldn&#39;t be
tested! So I would do nothing for simple #is. and I don&#39;t like #is:
because it looks like a class type test... but that is part of the
point, eh?<br>
<br>
I&#39;ll have to go back to the original example (by <a href="mailto:siguctua@gmail.com" target="_blank">siguctua@gmail.com</a>,
and read more about lambdas) but I thought that CVLambda would
implement #isCVLambda  to return true when it can be verified to be
one. The example did not illustrate #doesNotUnderstand:.<br>
<br>
Back to the question of adding behavior to classes that you don&#39;t own.
VisualWorks has a means to extend a class in a different package ... as
I recall. As I recall, squeak has no such capability, right?<br>
<br>
</div></div></blockquote></div><br>Squeak certainly has that capability, but I would discourage you from using it.<br clear="all"><br>Changing the implementation of doesNotUnderstand: is a code smell. You&#39;re starting to play with voodoo and you need a *very* good reason to do it. Otherwise you&#39;ll have made yourself a very difficult application to debug.<br>
<br>In my opinion (which doubtless isn&#39;t shared by everyone here), base classes such as Object should not have a lot of &gt;&gt;isXXX methods. &gt;&gt;isBoolean and &gt;&gt;isString are okay (although I never use them), but &gt;&gt;isMorph or &gt;&gt;isColor or anything not related to the Kernel classes are pollution.<br>
<br>If you&#39;re using an &gt;&gt;isXXX method, then your code probably needs refactoring. It means you&#39;re implementing class specific behaviour using conditional &gt;&gt;ifTrue: blocks. Typically, your code will be working with subclasses of a specific class, and you&#39;d invoke polymorphic methods to get class specific behaviour rather than using conditional blocks such as &gt;&gt;ifTrue:, &gt;&gt;ifFalse: etc.<br>
<br>If your code really does handle an object of any possible class (which is rare but does occur), then you can use &gt;&gt;isKindOf:, &gt;&gt;isMemberOf: and &gt;&gt;respondsTo:. <br><br>Igor&#39;s lambda example was a bit complex for me to work through so I can&#39;t really comment on it.<br>
   <br>Gulik.<br><br>-- <br><a href="http://gulik.pbwiki.com/">http://gulik.pbwiki.com/</a><br>