<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font face="Georgia">Well, the comments about returning self rather
      than nil in Louis's example seemed to assume the rest of his code
      would return self, but that code was not in evidence, so who
      knows.<br>
      <br>
    </font>
    <div class="moz-cite-prefix">On 10/23/13 4:46 PM, Chris Muller
      wrote:<br>
    </div>
    <blockquote
cite="mid:CANzdToH-7xgwFY-W7=d_p9++CXELmZFdYst2t9ddnWLQgaq--w@mail.gmail.com"
      type="cite">
      <pre wrap="">On Wed, Oct 23, 2013 at 1:11 PM, Bob Arning <a class="moz-txt-link-rfc2396E" href="mailto:arning315@comcast.net">&lt;arning315@comcast.net&gt;</a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">Except that cascade is not affected by the return value...
self foo; bar.

cares not what is returned by foo.
</pre>
      </blockquote>
      <pre wrap="">
Your example assumes the send is to self.  I was thinking of an
example where it was sent from another class:

  louisObject methodWhichReturnsNilInsteadOfSelf
    message1 ;
    message 2

can no longer be done.  Before, it could.

But, ok, you're right, it's not specifically cascading that is affected..  :)

</pre>
      <blockquote type="cite">
        <pre wrap="">
I think there was a discussion some time ago that self might not have been
the best default return value. YMMV.

Cheers,
Bob

On 10/23/13 2:05 PM, Chris Muller wrote:

Either. But in general use ^self  rather than ^nil
so that it acts the same as the implicit ^self when you drop out the end of
a method.

+1.  Senders might want to cascade.

Bob Arning wrote:

I prefer the first - it gets one case out of the way quickly.

Cheers,
Bob

On 10/23/13 10:12 AM, Louis LaBrunda wrote:

Hi,

I'm about to write a method where I need to test whether to do something or
just get out.  What is the best practices way to do this?  For example:

(a = b) ifTrue: [^nil].
*The code that does the work*

or:

(a = b) ifFalse: [
    *The code that does the work*
].

I think the second is better style but I have used both.  Generally using
the first when *The code that does the work* is long and the second when it
is short.

Is there any speed difference between them?  I doubt it but I thought I
would ask anyway.

Lou
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
<a class="moz-txt-link-freetext" href="mailto:Lou@Keystone-Software.com">mailto:Lou@Keystone-Software.com</a> <a class="moz-txt-link-freetext" href="http://www.Keystone-Software.com">http://www.Keystone-Software.com</a>





________________________________












</pre>
      </blockquote>
      <pre wrap="">

</pre>
    </blockquote>
    <br>
  </body>
</html>