2 ms·
> generated code Not a problem: either the PHP generated is only safe for a particular version, or they can add parenthesis to distinguish the cases. > to con
by randallsquared 18y ago
> generated code
Not a problem: either the PHP generated is only safe for a particular version, or they can add parenthesis to distinguish the cases.
> to convert stuff to explicit true/false
I suppose. That would seem like a surprising use to me, and would merit an explanatory comment, but given that, it might be better to just explicitly cast ("(bool)$name"), which saves the comment, and only adds four characters over "!!$name".
- qqq 18y agoEvery syntax quirk that requires the code generator to do something (e.g. add more parentheses) makes code generation harder.
- randallsquared 18y agoI would naively expect every single expression to be surrounded by parenthesis by default, implemented in the lowest level writeExpression() function or whatever. But I've never written a translator, so...