4 ms·
It is ambiguous (albeit deliberately so), therefore parens are required. If don't believe I've used that word wrong. That's precisely the language quoted in th
by paulddraper 3y ago
It is ambiguous (albeit deliberately so), therefore parens are required.
If don't believe I've used that word wrong. That's precisely the language quoted in the article for JavaScriptCore/Safari:
SyntaxError: parentheses must be used to disambiguate
- reanimus 3y agoAmbiguous is definitely correct. The precedence is ambiguous, but the language chooses to make that ambiguity illegal. In some languages it might fall under the realm of "undefined behavior" (in that it compiles/validates syntactically but will likely blow up at runtime), though most linters for even those languages warn you about that. Alternatively, it might define a precedence for you, avoiding the need for parens.
- lifthrasiir 3y agoFor what it's worth, the current title of this submission is "JavaScript has multiple (ambiguous) operator precedence chains", which is made up by the submitter. I question the use of a word "ambiguous" here, because it really sounds like that JS somehow had two precedence chains and had to resolve them. Absolutely not. But it's correct that the programmer intent would be indeed ambiguous, hence that error message.