[squeak-dev] Formatting?

Eliot Miranda eliot.miranda at gmail.com
Thu Jun 2 14:49:48 UTC 2016


Hi Tim,

> On Jun 1, 2016, at 5:42 PM, tim Rowledge <tim at rowledge.org> wrote:
> 
> Now I *don’t* like this 
> 
>>>     coll do:
>>>           [ :each |
>>>           statement1.
>>>           (condition1) ifTrue: [ statement2 ] ]
> 
> At least if applied vigourously. When there are *short* statements I’d rather see
>  coll do: [:each| statement]
> or
> coll do:[:each| (condition) ifTrue:[statement]]
> etc, keeping as much as possible nicely compact.

That's just what Kent's style guide recommends.  If the block fits comfortably on one line then by all means put it in one line.  The primary constraint is that the block braces form the top left and bottom right of a rectangle which contains all of the block's text.  So a one line block trivially satisfies that.  The main thing this precludes is attaching the opening brace to the end of an ifTrue:/ifFalse; far to the right of the start of the first line of the block;

    braceAtTheEndOfLine ifTrue: [
         (this isA: #Monstrosity) because:
                blocks are objects not syntax].

> I find pretty-print makes code far too ‘tall’ for my taste - oh and hardwrapping comments is really annoying!

+1 & +1

> 
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Useful random insult:- Only playing with 51 cards.
> 
> 
> 
> 


More information about the Squeak-dev mailing list