This happened.
You might think I’m about to go off on some Swift rant (and trust me there is a Swift rant inside me waiting to emerge) but it’s the second checkbox that made my mind explode.
From:
To:
Who thought this was a good idea? I’ve never been a fan of left-aligned case
in Swift although I embrace it as the standard. But in Objective-Freaking-C? As a standard Apple-blessed toggle in Xcode? No! Thrice no! The option enabling the choice is bad for Swift and worse for Objective-C.
Why is this option in there and why is it available for both languages? It would be best to, as Joe Groff put it, “let sloth naturally lead everyone to pick the default” given that the feature has been expressed in Xcode. Or better yet, file some bug reports for the broken feature.
Each language default reflects years (and decades) of language style consensus:
- Swift: keyword-aligned.
- Objective-C: “scope”-aligned.
This new choice in preferences is madness.
Talk me down from here, friends.
One Comment
I’ve been programming in C on and off for thirty years and most code I’ve seen in that time aligns the case labels with the `switch` keyword. The style you don’t like traces all the way back to the beginnings of the C language.
It stems from K&R first edition which has a style of indenting blocks by six characters. Indenting the case labels would mean the code in each case would be indented by 12 characters which is a lot on a terminal screen only 80 characters wide.
It’s not half as stupid as K&R’s habit of hiding the opening brace on the end of the previous line instead of putting it on a line by itself and vertically aligning with the closing brace which is what any sane person would have done. Unfortunately, that error has propagated throughout the world of C syntax style languages and Xcode has little support for doing things properly.