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
}
Woho! I just won a religious war.