Closed dckc closed 4 years ago
Given the stated rules -- never start a line with [, (,
, +, *, /, -, ,, .,` -- and given high quality IDE support, which is plausibly as good as he says, I can believe that the hazard goes away. But that's a lot of work and narrow set of assumptions for questionable benefit. I'd rather invest my IDE engineering on real problems, of which we have plenty.
To answer your question, "What exactly is the hazard/risk?", it is that the programmer thought they wrote a program whose parse would give it one meaning but the machine runs it as a program with a different meaning based on a different parse. Without his restrictions and IDE support there are plenty of examples caused by ASI. Given his restrictions and IDE support, I don't know if there are any examples where ASI causes such ambiguity.
Here's a tricky non-ASI example. What does the following code do as a script? As a CJS module? As an EcmaScript module? As an EcmaScript module packaged up by your favorite packer, say rollup?
let x = 8;
let y = 9;
let z = y <!--x;
console.log(z);
OK. Thanks. I recall that it simplifies writing a Jessie parser, which is probably enough motivation for this scope.
What exactly is the hazard / risk?
I filed https://github.com/tgrospic/rnode-client-js/issues/16 asking @tgrospic to avoid it, but when I did so, I struggled to come up with any argument other than authority; i.e. Agoric says so (and Crockford used to say so). @tgrospic is (quite reasonably, as far as I can tell) pushing back.