[webkit-dev] Proposing style guide change regarding braces on conditional arms

Darin Fisher darin at chromium.org
Thu Dec 3 20:17:31 PST 2009


Ditto.

On Thu, Dec 3, 2009 at 7:25 PM, Kenneth Christiansen <
kenneth.christiansen at openbossa.org> wrote:

> I'm OK with both. Peter's is my preferred solution, though.
>
> Kenneth
>
>
> On Thu, Dec 3, 2009 at 11:39 PM, Dirk Pranke <dpranke at chromium.org> wrote:
>
>> +1. Peter's is better than Maciej's is better than status quo.
>>
>> -- Dirk
>>
>> On Thu, Dec 3, 2009 at 6:24 PM, Jeremy Orlow <jorlow at chromium.org> wrote:
>> > On Thu, Dec 3, 2009 at 6:15 PM, Maciej Stachowiak <mjs at apple.com>
>> wrote:
>> >>
>> >> On Dec 3, 2009, at 5:48 PM, Michael Nordman wrote:
>> >>
>> >> what peter pitched and what mjs pitched are one and the same i think
>> >>
>> >> * When all arms of a conditional or loop are one physical line, do not
>> use
>> >> braces.  If any arms are more than one physical line (even if they are
>> one
>> >> logical line), use braces on all arms.
>> >>>>>
>> >>>>> One possible conservative modification to the rule is that if you
>> have
>> >>>>> a multi-block if ... else if ... else chain, then if even one body
>> has
>> >>>>> braces, all should. I think that would tend to reduce rather than
>> increase
>> >>>>> visual noise, as all the "else" keywords would line up where right
>> now they
>> >>>>> look ragged.
>> >>
>> >> To be clear: my intent was to propose something different than Peter's
>> >> suggestion. Specifically, I suggest we do *not* change the rule for a
>> simple
>> >> if/else statement with only two clauses. Those would still be able to
>> have
>> >> braces on only one of the two clauses. But if/else chains of more than
>> two
>> >> clauses would have to be consistent.
>> >> For anyone who agreed with my suggestion, you may want to consider
>> whether
>> >> you still agree in light of this clarification.
>> >
>> > Is this formally up for a vote then?
>> > For what it's worth, I think Peters is the most readable, but Maciej's
>> is
>> > better than what it is now.  I find stuff like
>> > if (blah)
>> >   blah
>> > else {
>> >   blah
>> > }
>> > very distracting.  But stuff like
>> > if (blah)
>> >   blah
>> > else if (blah)
>> >   blah
>> > else if (blah) {
>> >   blah
>> > } else
>> >   blah
>> > is definitely even worse.
>> > _______________________________________________
>> > webkit-dev mailing list
>> > webkit-dev at lists.webkit.org
>> > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>> >
>> >
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>
>
>
> --
> Kenneth Rohde Christiansen
> Technical Lead / Senior Software Engineer
> Qt Labs Americas, Nokia Technology Institute, INdT
> Phone  +55 81 8895 6002 / E-mail kenneth.christiansen at openbossa.org
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20091203/dad20db5/attachment.html>


More information about the webkit-dev mailing list