Skip to content

Optional Parentheses: You're Doing it Wrong

blog.mojotech.com
11 pointsdberube2 comments
On HN

Comments

F(x) versus I p -- functional versus imperative, idempotent versus side effect... that's an interesting convention.

I believe the mess with optional parentheses is mainly due to the left/righ associative rule. i.e. I have difficulties to properly group subexpressions.

My style: don't assume reader knows about associativity rules so much, prefer explicit parentheses when ambiguities about interpretation is solved by these associativity rules.

For language designers: maybe parentheses should be mandatory when sufficiently nested?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.