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 <[email protected]> wrote:

> On Thu, Sep 3, 2015 at 2:28 AM, stepharo <[email protected]> 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

Reply via email to