Hacker News new | ask | show | jobs
by marvelous 2606 days ago
I wish more language constructs used postfix notation. It looks so natural to me when reading from left to right. Consider:

[a+2 for a in as if a > 3]

Vs

as.filter(a -> a > 3).map(a -> a + 2)

Sometimes I even wonder why variable assignment has to precede the assigned expression.

2 comments

> Sometimes I even wonder why variable assignment has to precede the assigned expression.

I think there's a good discussion to be had on preferring either prefix or postfix operators, but the answer to this question (which is also the answer to the question "why are we so accustomed to prefix keywords?") is easy: because ALGOL did it.

Hardly natural because the site where the binding is introduced follows the expression that uses the binding. When you type from left to right, editors will highlight that unknown binding until after you bind it.