<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 1, 2016 at 1:45 PM, Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On 01.06.2016, at 17:46, Chris Muller <<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>> wrote:<br>
><br>
>>> The predominant style in Squeak historically has been<br>
>>><br>
>>> coll do: [:each | each do something]<br>
>>><br>
>>> Ken Beck uses that in his “Best Practice Patterns” too. It’s also produced<br>
>>> by our formatter (but we rarely use that because it introduces weird line<br>
>>> breaks).<br>
><br>
> Actually, Kent Beck advocates a Rectangular Block formatting pattern,<br>
<br>
</span>I was mostly talking about the issue at hand, namely, whether to put spaces inside of the brackets. Which he does not do.<br>
<br>
This is (not entirely by coincidence) the typographical convention in English, too.<br>
<br>
That’s why I prefer it, independent of rectangular blocks or not.<br>
<span class=""><br>
> which is NOT produced by our formatter, unless you merge<br>
> Compiler-cmm.179 (which I've just recopied to the Inbox). I wasn't<br>
> successful in convincing the community to adopt it six years ago.<br>
><br>
> Besides the reasons already documented by Kents pattern, I like RB<br>
> because it presents a semi-"tiled" view of the code similar to<br>
> Scratch, but with textual, rather than graphical, tiles. Like this:<br>
><br>
> coll do:<br>
> [ :each |<br>
> statement1.<br>
> (condition1) ifTrue: [ statement2 ] ]<br>
><br>
<br>
</span>I’d write it Kent Beck-style, namely<br>
<span class=""><br>
<br>
coll do:<br>
[:each |<br>
statement1.<br>
(condition1) ifTrue: [statement2]]<br></span></blockquote><div><br></div><div>+1</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
</span>or maybe<br>
<span class=""><br>
coll do: [:each |<br>
statement1.<br>
(condition1) ifTrue: [statement2]]<br></span></blockquote><div><br></div><div>-1. Blocks braces should delineate rectangular areas for us visual thinkers. So it's fine if it fits on one line, but if it fits on two, break to a new line and indent please.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
> It is so much more OO than "textual" formatting like this:<br>
><br>
> coll do: [ :each |<br>
> statement1.<br>
> (condition1) ifTrue: [<br>
> statement2.<br>
> ]<br>
> ]<br>
<br>
</span>Agreed. I don’t think I’ve seen much of this style in Squeak. It’s ugly.<br></blockquote><div><br></div><div>All to much of it exists in some places I won't illuminate. Agreed; I find it both horribly ugly and wasteful of screen real estate.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
<br>
> I really don't notice any predominant style among different authors of<br>
> Squeak,<br>
<br>
</span>I do. Anything that’s not written in that style looks jarring to me. Like Andreas’ habit of omitting the space between a keyword message and a block (ifTrue:[foo]).<br></blockquote><div><br></div><div>+1.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> and I don't think attempting to establish any kind of<br>
> formatting standard or style would be counterproductive for the<br>
> community (not that anyone is suggesting that). Instead, its probably<br>
> best to let our individual imaginations flow the way they do, and let<br>
> the IDE take care of each of us individually. Methods can be quickly<br>
> and easily formatted on access and/or save. However, I do recommend,<br>
> if one is only changing only one or two lines of a longer method, they<br>
> should try to maintain the prior author's format. Also, never submit<br>
> a change to trunk that ONLY changes the formatting of a method,<br>
> please.<br>
<br>
</span>IMHO readability suffers wth mixed styles. Be creative in your coding, not in your formatting. I think it would be a good idea to adopt a style guide. Beck’s would be a good starting point.<br></blockquote><div><br></div><div>+1. But having a good formatter which can implement Kent's style guide would be nice. We're not there yet.</div><div> </div><div>I wonder if we should include a précis of Kent;s guide in a workspace window in new releases. We could put a short guide/cheat sheet in one, and a formatting guide in another.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">- Bert -</font></span><br></blockquote></div><br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>