[squeak-dev] Re: Code formatting patterns

Chris Muller asqueaker at gmail.com
Sat Oct 5 20:52:50 UTC 2013


> Bert, I like your vertical alignment of square braces for blocks.  For
> myself, this is my only absolute formatting rule, excepting only when
> opposing braces fit the same line.  Unfortunately most Smalltalk code puts
> the closing brace as soon as possible at the end of the last statement of
> the block.  Sometimes three or four closing braces pile up together at the
> end of a line, and it is slow to isolate the matching open braces. (Maybe

Not if you use Shout.  Each level of parentheses and blocks specifies
its own color.

Nor if you simply click in the inner edge of the bracket.  Or Command+Space it.

Most Smalltlak code employs Rectangular Block because it's an
object-oriented format.  Like a text-version of Scratch tiles.

> that indicates other architectural issues with the code, but the reality is
> these situations occur.)  As a slight twist of my own to your last example,
> I indent the first statement one tabstop.
>
> [ mySoundRecorder
>                 copyTo: resultBuf from: j to: (j + n - 1)
>                from: buf startingAt: firstInBuf
>                normalize: nFactor dcOffset: dcOffset
> ] on: AttemptToWriteReadOnlyGlobal do:
> [ :noti |
> noti someOtherMethod.
> noti resume: true
> ]

The above, by contrast, looks and feels procedural, with the brackets
"delimiting" the starts and ends of code segments.


More information about the Squeak-dev mailing list