3 ms·
>If you wanted to parse "0. toString()" correctly, you could use unbounded lookahead Right, which is what I said. If you agree that unbounded lookahead is requ
by foldr 6y ago
>If you wanted to parse "0. toString()" correctly, you could use unbounded lookahead
Right, which is what I said. If you agree that unbounded lookahead is required then we don't really disagree, except on the somewhat subjective question of how 'hacky' that is.
If I understand correctly, you suggest that unbounded lookahead could be avoid by allowing '0.toString()' but not '0. toString()', while still allowing both '(0).toString()' and '(0). toString()' and both 'foo.bar' and 'foo. bar'. That would produce highly counterintuitive results in some instances:
Parsed as one expression:
{}.
foo
Parsed as two statements:
0.
toString()
But again, it is really a subjective judgment. Obviously you could modify Javascript in this way, and on that point there is no disagreement.