Stef, It pains me to have to be a pain about this. I never use a space after a colon; what other people do is their business, but I much prefer having the space gone. Other formatting concerns are far less trivial to me than a personal preference.
Lukas is correct about using a formatter, but it has to be a separate or optional step because the current state of formatting is hostile to comments. If moving code to Pharo has taught me anything, it is that I have been correct to embed dated (month-year) comments in my code. The RB scatters them to the four corners, which is why I don't use the thing. I also format code in ways that are analogous to phrasing in music. I tried to capture it in a custom formatter, and quickly realized that I see design, workflow, organizational politics, etc., and the machine sees syntax. It will never "understand" what belongs together and what does not. Anything that forces formatting on me is defective. If there is a way for me to optionally format my code with a Pharo formatter, I'm happy to do so as I turn it over. Anything that I am actively using will be littered with comments (until I tire of them[*]) and formatted in a way that helps me see the big picture long after the machine smashes it down to a mere sequence of byte codes. Bill [*] every so often, I clean out truly obsolete information, but that is more a question of the amount of change that has occurred, not chronological age. In moving to Pharo, I ran across couple of related defects from 2003, and fixed them within an hour thanks to comments in the code. This is one of many such stories that have formed my (somewhat stubborn) thoughts on code formatting. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Lukas Renggli Sent: Sunday, February 28, 2010 4:52 AM To: [email protected] Subject: Re: [Pharo-project] about code formatting in pharo I would use a formatter, like this you can make it really consistent. The RBConfigurableFormatter is pretty good in that, the only thing I don't like is the placing of the square brackets. I should look into fixing that, otherwise it formats exactly the way I would format myself (and in the way you propose). Lukas On 28 February 2010 10:36, stephane ducasse <[email protected]> wrote: > Hi guys > > I would like to build a set of canonical code formatting convention for Pharo. > I need your help. Now take time before replying :) I would like to > structure the discussion and proceed step by step. So at max I would like to > discuss one or two formatting approach per mail. > Once we agree I would like to define a wiki page. > > > **Space after : rule > ============= > for example I would like to always have a space after a : > > classes := Smalltalk allClasses select:[:aClass| > (aClass class includesSelector: #cleanUp) > or:[aClass class includesSelector: #cleanUp:] > ]. > > -> > > > classes := Smalltalk allClasses select: [:aClass| > (aClass class includesSelector: #cleanUp) > or: [aClass class includesSelector: #cleanUp:] > ]. > > > **Block arg rule > ============= > Do we want a space before and after block arg > > Smalltalk allClasses select: [:aClass :method| > > -> Smalltalk allClasses select: [ :aClass :method | > > > ** selector or block indented compared to receiver > ======================================= > > Finally do we follow kent block ideas? > > classes := Smalltalk allClasses select: [:aClass| > (aClass class includesSelector: #cleanUp) > or: [aClass class includesSelector: #cleanUp:] > ]. > > -> > classes := Smalltalk allClasses > select: [:aClass| (aClass class > includesSelector: #cleanUp) > or: [aClass class > includesSelector: #cleanUp:]]. > > Stef > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
