News for hackers. Stuff that matters.
Re:An Alternative Operator Precedence Rule (2013) by ajanuary on Wednesday July 15, 2015 @05:56AM (#9890503)
It breaks down as soon as you reach a single layer of nesting.

    (a + b) / ((c + d) * e)
would be (with pure whitespace)

    a+b  /  c+d * e
you'd probably end up mix-and-matching

    a+b / (c+d * e)
Re:An Alternative Operator Precedence Rule (2013) by nhaehnle on Wednesday July 15, 2015 @06:55AM (#9890659)
I would argue that your last version is actually the most readable. Obviously, opinions are going to differ as they always do, but my preference among your examples is 3 over 1 over 2 (I cannot imagine preferring 2, because the difference in whitespace amount is easy to miss at a glance).

There's bound to be some resistance and an "awkward feeling" at first, but this does seem like a nice suggestion.

Unfortunately, it's not a change that you can just apply to an existing programming language, but perhaps it would be reasonable to start by warning and eventually erroring where whitespace does not fit the existing precedence rules.

Re:An Alternative Operator Precedence Rule (2013) by vorg on Wednesday July 15, 2015 @01:58PM (#9892925)
> It breaks down as soon as you reach a single layer of nesting

Then restrict it to a single nesting level, which aligns with the idea of making easy things easy (i.e. single-level precedence), and harder things possible (i.e. parens for more than two levels).