Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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".




Every syntax quirk that requires the code generator to do something (e.g. add more parentheses) makes code generation harder.


I 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...




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: