[squeak-dev] Formatting?

Bert Freudenberg bert at freudenbergs.de
Thu Jun 2 22:21:50 UTC 2016


On 02.06.2016, at 03:28, Chris Muller <asqueaker at gmail.com> wrote:
> 
>> +1.  But having a good formatter which can implement Kent's style guide
>> would be nice.  We're not there yet.
> 
> Why not give [1] a try?  I've tweaked it to remove the spacing which
> you and Bert don't like.  Even though I think its a mistake to remove
> this whitespace, we could at least have a pretty-print that is usable
> OOTB and based on a known and thought-out rationale that suits
> Smalltalk.  Does anyone know the origins of the formatting we have
> now?
> 
> [1] -- Compiler-cmm.323 in the Inbox.  I believe its at least 90% Kent
> Beckian, but there are one or two corner-case bugs I couldn't figure
> out how to solve..

It’s pretty good. 

There shouldn’t be a space before a cascading semicolon though.

I also noticed a bug where sometimes there is no space between multiple args to a block, e.g. in Behavior>>allSubclassesWithLevelDo:startingLevel:.

And it still produces excessively tall code. This:

	classAndLevelBlock
		value: self
		value: level.

... should be on one line. And if possible


	0
		to: height - 1
		by: 16
		do:
			[:y | ...

should be

	0 to: height - 1 by: 16 do:
		[:y | ...

The rule being something like “if only the last arg is complex, put the message on one line, and the last arg indented by one on the next”.

- Bert -


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4207 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160603/5b293fbc/smime.bin


More information about the Squeak-dev mailing list