On Sep 29, 2011, at 10:16 PM, Dean Landolt wrote:
> because of no { on same line as the head, but it would not fix the second
> case Waldemar showed:
>
> if (a + b)/g > f {f = (a + b)/g}
>
> This case is a paren-full if head followed by an unbraced body, a useless
> regexp expression statement. It's valid ES5.
>
>
> Not on its own it's not -- it may close a block but what about the rest of
> that block? Your curlies won't balance and you've got a syntax error.
Yes, but if there's no left context with an unclosed open curly, you get the
error immediately. Waldemar's scenario, as he implied, was that there were
unclosed {s to the left, which would make the possibly-much-farther-along extra
} error obscure.
> Isn't "use strict" a useless expression statement? But that's about the only
> useful use of useless expressions I can think of.
It is not, by definition, in ES5. That makes it tricky, but once you opt into
Harmony, ES6 or higher let's say (I'm cheeky about using 6), then it is again
useless. Harmony is built on ES5 strict. No more string literal pragmas, they
bite back. And (not yet anyway) no more stricter strict modes.
/be_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss