Proposal: Modify automatic semicolon insertion in strict mode
david.hopwood at industrial-designers.co.uk
Tue Dec 9 01:00:46 PST 2008
Brendan Eich wrote:
> On Dec 8, 2008, at 9:48 PM, David-Sarah Hopwood wrote:
>> Why? That would only happen if you added "use strict;" to a program
>> fragment without testing that the resulting program still parses
> Parses and executes over all paths correctly, you must mean.
No, I don't. The context was an argument against removing semicolon
insertion from strict mode. If you add "use strict;" (to code that is
statically known, not to code that is passed to 'eval') and the resulting
program still parses, then you know that the lack of semicolon insertion
in strict mode made no difference. It isn't necessary to run the code in
order to test that.
Of course you should do other testing as well, to account for other
differences between non-strict and strict mode, but that's not relevant
to semicolon insertion.
>> which is an obviously silly thing to do. If it fails to parse, *and*
>> no programmer who can fix it is available, then don't add the "use strict;".
> Why impose unnecessary work on someone trying to use strict?
I repeat, not even checking that code still parses after adding
"use strict;" is obviously silly, and we should not claim that strict
mode is usable without doing that -- whether or not it does semicolon
insertion. In other words, the work is necessary.
>> Alternatively, put the source through a filter that adds the semicolons
>> automatically, once and for all. What am I missing here?
> What filter? Procured from where? At what cost in time and trouble?
One that I'd write and open-source, if it were sufficient to win this
More information about the Es-discuss