Finally, a sensible code indentation standard (with bonus Atwood spotting)
-
-
-
The category you post this in is telling.
Sidebar WTF: at the obvious satire.
Funny Stuff: You know it's satire.
General: at the obvious satire and agree with the ridiculous statement.
Trolleybus Garage: You want others to and begin a flamewar.That said, I wouldn't be surprised if Atwood :whooshed: and agrees with the statement.
-
@The_Quiet_One Or, more likely, I just picked General because it was on top of the list and I couldn't be arsed to go through the category list at work when I had more productive slacking I could be doing.
-
@The_Quiet_One
Code indentation should become progressively more painful, as extra layers of nesting promote uncivilized code.
-
ERROR: CS0103 The name '■ ■ ■ ■ ■ ■ ' does not exist in the current context. Line 95, column 3284239993475613677123612345.
-
@izzion If you need deep nesting, you can just compute the sequence on the last digits and use that.
Edit: I must have been thinking of Pascal's Triangle, which would also make an
unusablepromising indentation scheme.
-
I actually like this. It seems like a better version of the linux 8-space indent thing.
-
@izzion And then he deletes all the responses saying it's a terrible idea.
-
@Magus said in Finally, a sensible code indentation standard (with bonus Atwood spotting):
It seems like a better version of the linux 8-space indent thing
Almost any indent strategy is better than the Linux 8 space indent thing
-
@Jaloopa No, in fact. In horrible low-level procedural languages, I have to agree with them that there isn't a better way to stop people nesting things.
-
@Jaloopa said in Finally, a sensible code indentation standard (with bonus Atwood spotting):
@Magus said in Finally, a sensible code indentation standard (with bonus Atwood spotting):
It seems like a better version of the linux 8-space indent thing
Almost any indent strategy is better than the Linux 8 space indent thing
One module I inherited uses "indent by 2 spaces, tab = 8 spaces". That's pretty awful to read/edit. The only thing that could have made it worse would be to use non-multiple-of-2 number of spaces (like 3). And maybe "tab != 4 or 8 spaces" (i.e. the usual standard).
So I guess "indent by 3, tab = 5 spaces" might make for a worse indent strategy than the Linux one.
-
@remi Which is why any indent strategy other than "Indent with tab, tab is whatever size you want" is stupid.
-
@remi said in Finally, a sensible code indentation standard (with bonus Atwood spotting):
indent by 3, tab = 5 spaces
So, fizzbuzz indendation?
-
@remi We're close to that: indent by 4, tab = 8 spaces. I'm not opposed to switching but I'm opposed to hitting the entire codebase in a conversion.
-
@Magus said in Finally, a sensible code indentation standard (with bonus Atwood spotting):
@remi Which is why any indent strategy other than "Indent with tab, tab is whatever size you want" is stupid.
Ah, someone who follows the only possible correct way to indent!
-
@izzion said in Finally, a sensible code indentation standard (with bonus Atwood spotting):
@remi said in Finally, a sensible code indentation standard (with bonus Atwood spotting):
indent by 3, tab = 5 spaces
So, fizzbuzz indendation?
No, that one would be:
- every 3 levels of indentation, add one line feed
- every 5 levels, put the
;
on a separate line afterwards (i.e.code\n;
) - every 15 levels,
do something even weirdernuke the code and start again because 15 levels is past madness.
Of course, given that no programmer can successfully pass the fizzbuzz test (well, I think so, given how much is talked about and how many faulty implementations can be seen?), what we would get is more like:
- every 3 spaces, add a line feed
- every 5 levels of indentation (or maybe every 5 tabs?), add one more level of indentation
- every 8 (5+3) or 2 (5-3) or sometimes at the end of the previous line (3-5), add a stray
;
- every now and again, erase one line of code.
-
@Magus said in Finally, a sensible code indentation standard (with bonus Atwood spotting):
@remi Which is why any indent strategy other than "Indent with tab, tab is whatever size you want" is stupid.
Agreed, as long as the tabstops are elastic.
Filed under: I keep bringing those up but my favorite editors still won't support it
-
@JBert I can take that or leave it, though I do favor it if possible. It works well in VS now even.