News for hackers. Stuff that matters.
Re:What is the most intrusive wart on your favourite program... by ars on Monday December 08, 2008 @02:21AM (#389617)
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.

Re:What is the most intrusive wart on your favourite program... by IsaacSchlueter on Monday December 08, 2008 @02:56PM (#390295)
Absolutely! 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.

Re:What is the most intrusive wart on your favourite program... by bayareaguy on Monday December 08, 2008 @02:52AM (#389632)
Tcl'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
   }