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

I prefer the rule in my own languages of "no arithmetic expressions whose meaning can be changed by adding parentheses". So `x + y - z` is allowed but `x - y + z` is not.


If operators are over-loadable, you support floats (in a non ffast-math mode), or you treat overflow in most non-modular-arithmetic ways, (x + y) - z and x + (y - z) are different.

Maybe it's worth saying "they're close enough to the same that parentheses should be optional", but I can definitely see the argument for just requiring them regardless.


Valid point, though my current language supports neither overloading, floats, nor non-modular integer overflow, and parentheses are permissible where not required (for extra-semantical cases where order does matter) :)


This is a cool idea that I hadn't heard or thought of before.




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

Search: