4 ms·
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 probabl
by ajanuary 11y ago
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)
- nhaehnle 11y agoI 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.
- vorg 11y ago> 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).