On Apr 23, 2010, at 2:17 PM, Brendan Eich wrote:

... here's a memory from the strict mode discussions in TC39, to answer this question: we talked about trade-offs in making it hard to migrate extant code into strict mode. Removing ASI from strict mode was considered too big a migration tax. That's it.

Here's a bit more memory to up the S/N ratio. The most objectionable case affected by ASI, everyone agrees, is:

function longwinded() {
    if (some) {
        if (deep) {
            if (condition) {
                return
"a lengthy, verbose, pleonastic, tautological, redundant result";

            }
            ...
        }
        ...
    }
    return "foo";
}

ASI makes that return\n be return;\n and leaves the result string as a useless expression in an unreachable statement.

Consider the above modified to remove the braces around the innermost if's consequent: then the string is a useless expression statement but it is quite reachable (it precedes the first ...-elided code).

This objectionable case, IIRC, we did talk about trying to fix by mandating control flow graph construction to find the dead code, and either reporting the error or correcting it by not inserting the ; after the return.

But such analysis is a high tax on implementors (well, it was in years past; not this year in my view). So we didn't mandate an error or (better) an exception to ASI's rules here.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to