<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Aug 26, 2007, at 11:55 PM, Bert Freudenberg wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">On Aug 26, 2007, at 11:01 , Fabio Filasieno wrote:</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">collection := OrderedCollection new.</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">collection add:1.</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 10.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">evaluates to one. Why ? Why not to collection ?</FONT></P> </BLOCKQUOTE><P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">You do not always add a simple value but the result of an expression. Having the #add: return the argument sometimes lets you avoid introducing a temporary variable. It is more useful this way, and for the cases where you actually want the collection you can use a cascade.</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">A similar point can be made that setters should return the argument instead of the receiver, although usually in Squeak they do not (Tweak revises that policy).</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"><BR></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">- Bert -</FONT></P> </BLOCKQUOTE></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>and Jason's already said that.</DIV><BLOCKQUOTE type="cite"><DIV style=""><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> cascade operator.  You don't like it, but it still provides</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">something that requires temporary variables to duplicate without it.</DIV></BLOCKQUOTE><BLOCKQUOTE type="cite"><BR style=""></BLOCKQUOTE></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>ahaaaa ..... I didn't get temp thing right.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>( obj send: (... complex stuff....) ) SendToComplexStuff</DIV><DIV><BR><DIV>But I finally got one reason for the cascade!!!!! At last ... (the complex thing helped me on that)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I didn't think of that, as I associated a "void" return with returning self !</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>For instance in C .. when you don't return anything (void) nothing comes out.</DIV><DIV>"In Smalltalk instead" I thought </DIV><DIV>" they do a smart thing. What can you do with void (or Ans) ?Nothing ! </DIV><DIV>So instead of returning a useless void they return self. Smart !</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>And this worked very well with the functional style that I like.</DIV><DIV>And I thought that side effects only functions like setters would be done perfectly.</DIV><DIV>And easy to read to !</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>But then ... </DIV><DIV>I thought: </DIV><DIV>" What ? (((( obj sendA: a) sendB: b) sendC: c) sendD: d ). You must me joking !!!!"</DIV><DIV>And my yohuoooooo :-D (no need to return self, it's the default ! ) ..... became argh ... here comes parenthesis.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Now if I put into the equation you put a complex expression...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>you avoid ...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>#Just Returning self</DIV><DIV>obj property: (complex_stuff) </DIV><DIV>     | property</DIV><DIV>     | ...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>and do </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>#fixing it with ... get some more cases under the belt.</DIV><DIV>obj property: (complex_stuff) </DIV><DIV>      ;  .....</DIV><DIV>     </DIV><DIV>Don't know yet if I like it that way ... </DIV><DIV>But now I see the point; and why somebody might prefer it that way.</DIV><DIV>I wouldn't be so sure now on cutting the ";" cascade out now.</DIV><DIV>I would say - but just now - that there is no pipe vs cascade thing. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks for ringing the bell ....</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>and the pipe might be still better than the parenthesis .... :o)</DIV><DIV>obj sendAndReturnComplexStuff: (... complex stuff....) | SendToComplexStuff</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV></DIV></BODY></HTML>