On Dec 9, 2009, at 9:41 AM, Maciej Stachowiak wrote:


On Dec 9, 2009, at 7:26 AM, Chris Marrin wrote:


I saw another patch get rejected today because of switch statement indentation. We discussed this last week, and I saw a lot of support for my proposal of indenting case labels from their switch. But the discussion did not end in resolution. To summarize, here are the options mentioned:

1) Case labels always have the same indentation as their switch (today's rule)

2) Case labels always indent 4 spaces in from their switch (my preference)

3) Case labels indent 2 spaces in from their switch. (Maciej's rule)

I was a little unclear on Maciej's rule. The last part of his rule is "In the case where a case label is followed by a block, include the open brace on the same line as the case label and indent the matching close brace only two spaces (but still 4 spaces for the contained statements)". Did he mean that the contained statements would be indented 4 spaces from the case label, meaning they would be indented 6 spaces from the switch?

I meant 4 spaces from the switch (i.e. 2 additional spaces from the case label).

switch (x) {
 case foo: {
   fooFunc();
 }
 case bar:
   barFunc();
}


Ok, the example above seems to be missing a space (it indents the case label 1 and the block 3). But I assume you meant to indent 2 and 4. If so, I understand what you are proposing. I still don't like it, but I understand it. I think a consistent 4 space indentation scheme avoids confusion and makes all the indentation tools in editors work correctly. If excessive indentation really is that big of a concern (which I don't think it is) I would rather see the current rule (rule 1) used.

-----
~Chris
cmar...@apple.com




_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to