<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 7, 2013 at 3:01 AM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On 2013-10-06, at 20:25, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br>

<br>
&gt; hence we&#39;re left with the war between visual thinkers (rectangular blocks) and verbal thinkers (pascal formatting).  just throwing wood on the fire ;-)<br>
<br>
I very much like rectangular blocks as the general formatting rule; this is how Smalltalk code looks &quot;naturally&quot; to me. However, you must *not* put a space inside the brackets because then they draw too much attention, standing there on their own:<br>

<br>
        [this is<br>
        rectangular]<br></blockquote><div><br></div><div>Ian Piumarta and I are anal enough to prefer</div><div> </div><div><span class="" style="border-collapse:collapse;font-family:arial,sans-serif;font-size:14px;color:rgb(0,0,0)">        [this is<br>
         rectangular</span></div><div><span class="" style="border-collapse:collapse;font-family:arial,sans-serif;font-size:14px;color:rgb(0,0,0)">         and nicely indented]<br></span></div><div><span class="" style="border-collapse:collapse;font-family:arial,sans-serif;font-size:14px;color:rgb(0,0,0)"><br>
</span></div><div><span class="" style="border-collapse:collapse;font-family:arial,sans-serif;font-size:14px;color:rgb(0,0,0)">;-)</span></div><div><span class="" style="border-collapse:collapse;font-family:arial,sans-serif;font-size:14px;color:rgb(0,0,0)"><br>
</span></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
vs<br>
<br>
        [ this is not<br>
        as rectangular ]<br></blockquote><div><br></div><div>yuck.  Ugly as sin.  Hate the extra whitespace.  I like asSortedCollection: [:a :b| a &lt; b], *not* *horrible* [ :a :b |, or even *worse*, [ : a : b | (argh)... ;-)</div>
<div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
There is, however, one case where the rectangular block formatting falls short, IMHO. That is when the block is the receiver of a message. For those, I still try to make them rectangular, but if that fails to look pleasant I occasionally put the closing bracket below the opening one in a line of its own, followed by the message.<br>
</blockquote><div><br></div><div>Yes, this is a pain.  In simple cases I&#39;ll write</div><div><br></div><div>     [some</div><div>      code]</div><div>        ensure: [more code]</div><div><br></div><div>but this all falls in a heap when there;s an on:do: involved. I try then to do</div>
<div><br></div><div>        [[some</div><div>          code]</div><div>                        on: SomeException</div><div>                        do: [:ex| something]]</div><div>                ensure: [more code]</div><div>
<br></div><div>cuz the lining up of the on:do: and the ensure: obscures things horribly:</div><div><br></div><div><div>        [[some</div><div>          code]</div><div>                on: SomeException</div><div>                do: [:ex| something]]</div>
<div>                ensure: [more code]</div></div><div><br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
Conventional wisdom says in that case one should refactor the method because it got too complex, which I agree to if there is a part that makes sense as its own method. However, I personally don&#39;t like one-off private methods just for the sake of simplifying one method. These typically need many arguments, have perhaps multiple return values, so the resulting complexity is not worth doing it.  Or am I missing something?<br>
</blockquote><div><br></div><div>Nope.  +1.</div><div><br></div><div>If it weren&#39;t for comments (and comments are /really/ important) we&#39;d have implemented a parameterised formatted by now that auto-formatted code to the preferences of the reader and this would all be moot.  But without a good AI I don&#39;t see how to spot and preserve while reformatting multi-line comments, comments with diagrams in them, etc, etc, etc.</div>
</div>-- <br>best,<div>Eliot</div>
</div></div>