I like... self xxx ifTrue: [ self bla. self foo. ].
Check the settings. It's called "align brackets" I think. He actually justifies the rules he chooses; they're not just personal
preferences.
This is thin ice. The justifications can still be based on personal preferences. Imagine tabs vs spaces flame wars, where both side do have valid arguments and you pick side based on what is more important to you. Now with the new Rubric and BlueInk you can automatically have methods formatted for you, so it doesn't matter as much what other people use. But generally agreement is a good thing. And what happened to the plain normal (in my mind/experience) ?
self xxx ifTrue: [ self bla. self foo ].
I'm pretty sure this is a bug; I've reported it few days ago. https://pharo.fogbugz.com/f/cases/edit/16422/BlueInk-Formatter-breaks-line-e... And there is settings for that also. Peter On Thu, Sep 3, 2015 at 7:29 AM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
And what happened to the plain normal (in my mind/experience) ?
self xxx ifTrue: [ self bla. self foo ].
I would say that is the most common one I've seen in the image. And it is how the old formatter worked.
On 03 Sep 2015, at 03:39, Eliot Miranda <eliot.miranda@gmail.com> wrote:
Hi Ben,
have you read Kent Beck's formatting rules? I wish we would adhere to these in our formatters. And I wish he would put the formatting rules in the public domain on the web (Kent?). He actually justifies the rules he chooses; they're not just personal preferences. And IMO they produce eleant, readable Smalltalk. I have to say your block formatting below is horrible. Blocks are blocks. [ & ] are /not/ the same as { & } in C. [...] define an *object*, not merely delimit syntax. As such any good Smalltalk format will emphasize the objectness of blocks. And IMNERHO that is to make them rectangles as in
self ifIWantedYouToWriteC ifTrue: [self useABloodyCCompiler. self useCCMinusPToMakeSenseOfTheDamageDoneByTheCPreProcessor]
On Wed, Sep 2, 2015 at 6:23 PM, Ben Coman <btc@openinworld.com> wrote: On Thu, Sep 3, 2015 at 2:28 AM, stepharo <stepharo@free.fr> wrote:
I do not really like all the formattings of kent. Because sometimes it
just
does not work. But this is why we ask franck (an interns to start to have a look).
For example I do not like
self xxx ifTrue: [ self bla self foo.
Agreed. Unneccessary waste of a line.
in the current default formatter. and I prefer
self xxx ifTrue: [ self bla. self foo But here the problem is that the self foo is not tab aligned because ifTrue: [
self xxx ifTrue: [ self bla. self foo So may be this one is a nice compromise
Not quite there. The "self bla" is still not actually vertically aligned.
I think that we should change some settings. In fact in alpha things are there to evolve until the release :)
I like... self xxx ifTrue: [ self bla. self foo. ].
for three reasons: * the first statement of the block is vertically aligned with the rest * vertical alignment of paired brackets makes visual matching *simple* * the vertical whitespace enforced by the closing bracket on its own visually groups blocks.
Now some people don't like the closing brace on its own because they prefer code density. So maybe this...
self xxx ifTrue: [ self bla. self foo. ] ifFalse: [ self baa. self moo. ].
But still I prefer...
self xxx ifTrue: [ self bla. self foo. ] ifFalse: [ self baa. self moo. ].
cheers -ben
-- _,,,^..^,,,_ best, Eliot