3 ms·
generated code to convert stuff to explicit true/false
by qqq 18y ago
generated code
to convert stuff to explicit true/false
- 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...