[squeak-dev] Re: Formatting?

Chris Muller asqueaker at gmail.com
Wed Jun 1 15:46:07 UTC 2016


>> The predominant style in Squeak historically has been
>>
>>         coll do: [:each | each do something]
>>
>> Ken Beck uses that in his “Best Practice Patterns” too. It’s also produced
>> by our formatter (but we rarely use that because it introduces weird line
>> breaks).

Actually, Kent Beck advocates a Rectangular Block formatting pattern,
which is NOT produced by our formatter, unless you merge
Compiler-cmm.179 (which I've just recopied to the Inbox).  I wasn't
successful in convincing the community to adopt it six years ago.

Besides the reasons already documented by Kents pattern, I like RB
because it presents a semi-"tiled" view of the code similar to
Scratch, but with textual, rather than graphical, tiles.  Like this:

      coll do:
            [ :each |
            statement1.
            (condition1) ifTrue: [ statement2 ] ]

It is so much more OO than "textual" formatting like this:

      coll do: [ :each |
             statement1.
             (condition1) ifTrue: [
                    statement2.
             ]
      ]

I doubt we'll ever bridge the transition from tile programming to text
coding with formatting like this..  :(

I really don't notice any predominant style among different authors of
Squeak, and I don't think attempting to establish any kind of
formatting standard or style would be counterproductive for the
community (not that anyone is suggesting that).  Instead, its probably
best to let our individual imaginations flow the way they do, and let
the IDE take care of each of us individually.  Methods can be quickly
and easily formatted on access and/or save.  However, I do recommend,
if one is only changing only one or two lines of a longer method, they
should try to maintain the prior author's format.  Also, never submit
a change to trunk that ONLY changes the formatting of a method,
please.

 - Chris


More information about the Squeak-dev mailing list