[squeak-dev] Coding style

Bert Freudenberg bert at freudenbergs.de
Wed Mar 10 10:25:32 UTC 2010


On 10.03.2010, at 02:53, commits at source.squeak.org wrote:
> 
> + 	^packageList ifNil:[packageList := (PackageInfo allPackages collect: [ :each | each packageName]) sort]!
> - 	^packageList ifNil:[packageList := (MCWorkingCopy allManagers collect:[:each| each packageName]) sort]!


This to me replaces one style of too few spaces with another of too many ;)

I'd have written

	collect: [:each | each packageName]

but I just looked at the Blue Book and there indeed is a space before and after a block argument. OTOH it does conform to Kent's examples:

	http://c2.com/ppr/formatting.html

Generally I feel this is not much of a problem. But I have occasionally seen rather strange formatting, So for the benefit of better readability, do we want to have general rules for formatting code?

Many projects have such rules. One good example IMHO is PEP-8 in the Python community.

For Smalltalk I only know Kent Beck's rules from "Best Practice Patterns" which seem like a good set. And IMHO any rules are better than none, so maybe we want to just agree that if in doubt, follow that suggested practice?

- Bert - (hoping this does not open a can of worms ...)




More information about the Squeak-dev mailing list