[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reductions during Bison error handling
From: |
Hans Aberg |
Subject: |
Re: Reductions during Bison error handling |
Date: |
Fri, 24 May 2002 17:34:04 +0200 |
At 05:49 -0700 2002/05/24, Paul Eggert wrote:
>> In math, typically the semantically more significant (to the human
>> reader's cognition) quantity should be on the LHS.
>
>In math, one normally sees expressions like '0 < i < n'. The closest
>equivalent in C is '0 < i && i < n'. That is what I was using here.
>I find this more readable than 'i > 0 && i < n'.
I think that one would normally see $0 < i < n$ or $i > 0$, $i < n$, like
for example in
f(i) = | a, i <= 0
| b, 0 < i < n
| c, i >= n
Here $i$ is the important quantity that one wants to pin down, so it ends
up on LHS. Here, $0 < i < n$ is an available shorthand, but if it would not
have been permitted, I think $i > 0$, $i < n$ is just OK.
> Once you get used
>to the "<"-oriented style I hope you'll agree that it has its advantages.
I think computer scientists are over-zealous in trying to pin down the
style, in the process disregarding other kinds of prudence.
>> One should be aware of that long statements in the "for" and "while" heads
>> decreases legibility.
>
>Yes, on second thought that part of the change was a bit overboard.
One other danger I have noticed is that old programming styles may survive
into new programming languages. For example, some do not like "break"'s in
C statements, because they are not available in Pascal, and further, one
might surmise that in old C compilers, they perhaps sometimes handle that
well. But today, when that is available and no problem in modern C
compilers, one should use such constructs in order to make the code more
expressive to the human reader.
Hans Aberg