Proposal: Modify automatic semicolon insertion in strict mode

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Mon Dec 8 21:48:53 PST 2008


Brendan Eich wrote:
> On Dec 7, 2008, at 9:53 PM, David-Sarah Hopwood wrote:
>> No, semicolon insertion occurs also in strict mode. Perhaps it shouldn't.
> 
> TC39 already agreed it should, for ES3.1. Strict mode has enough
> migration-tax that we do not want to risk making it unused in practice
> due to lack of ASI. It's hard to know what would happen, but the sense
> of the committee was to leave ASI alone in strict mode in order to make
> strict mode easier to use in existing code, as well as new code meant to
> work in old browsers where the author didn't test carefully.
> 
> Such undertesting happens, just as for quirky HTML -- the XHTML utopia
> notwithstanding (IE processed text/xhtml using quirky syntax error
> correction, guaranteeing non-wellformedness to some degree in the
> deployed content). Missing semicolons happen too, in spite of the best
> intentions.
> 
> Never mind that many JS developers would have our heads for removing ASI
> from strict mode, the problem remains that programmers don't know where
> they depend on ASI, and if we try to force them to care, we'll fail --
> "they" may not even be around, and the content errors will be foisted on
> innocent end users of the incumbent content.

Why? That would only happen if you added "use strict;" to a program fragment
without testing that the resulting program still parses correctly, 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;".
Alternatively, put the source through a filter that adds the semicolons
automatically, once and for all. What am I missing here?

-- 
David-Sarah Hopwood


More information about the Es-discuss mailing list