Skip to content
Prev 31280 / 63424 Next

Bug in the parser (?) (PR#13504)

johnc.deva at yahoo.com wrote:
A bug report with a ? in the title is in general ill-advised. If you are
not sure that something is a bug, then ask a question instead.

In this case, no, it is not a bug. Syntax is syntax and "if(x,1,2)" is a
syntax error no matter how if() is defined. Parsing is controlled by the
fact that "if" is a keyword, the function definition is not used at all
at that stage. `if`(x,1,2) works perfectly well, though, at least until
you try deparsing it:
if (x) 1 else 2


Redefining "if" is a really Bad Idea, excepting things like code
analysis tools (which I believe are the main reason it is not explicitly
forbidden).