>
> However, given the reality of ASI, in practice there are two ways to
> terminate statements. Then the question becomes, what is more usable,
> optionally turning off ASI, or under prior opt-in to Harmony, improving ASI?
>
I would love to be able to ditch my ";" in JS. There are other languages
that use them optionally without much difficulty (Scala and Go come to
mind). Would it be possible to under harmony move to semantics more similar
to those?
My understanding is that JS thinks "ignore all newlines unless it turns out
I need one" while other languages think "*use* all newlines unless it turns
out I can't". The latter seems like a saner response since most newlines
*are* intended to be statement boundaries.
Changing JS to treat all newlines as significant would address nasty cases
like:
var a = 1
var b = 2
var c = { foo : "bar" } // by default would assume the newline here *is*
significant
[a, b].forEach(alert)
The semicolon elision rules from what I've seen are a good bit simpler than
the current insertion ones: If a token that can't end an expression or
statement precedes a newline, eat the newline.
- bob
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss