2 ms·
That's a pretty good argument to never use Allman, Whitesmiths, GNU, or Horstmann indent style. There can only be one and that's K&R. Woho! I just won a relig
by ars 18y ago
That's a pretty good argument to never use Allman, Whitesmiths, GNU, or Horstmann indent style. There can only be one and that's K&R.
Woho! I just won a religious war.
- bayareaguy 18y agoTcl's string quoting conventions also try to force you to use K&R style for procedure bodies. e.g proc foo {x} { # do stuff } but if you really want to get around this you can abuse the continuation character proc foo {x} \ { # do stuff }
- IsaacSchlueter 18y agoAbsolutely! For Javascript at least, putting the { on the same line as the thing that caused it is pretty much the only rational policy. The weird thing is just how the interpreter handles this: return; { a: "foo"; } That's a null return, a block (not that JS supports block-level scope, so blocks are pointless), a labeled line (line-labels aren't actually used for anything, since there's no GOTO), and on that labeled line, there's a string expression that does nothing. So, this is really like 4 different warts working together, but semicolon insertion is by far the most insidious. Also, liberal use of parens can help prevent semicolon insertion bugs.