ambiguous ?
Jim Giles
jlg at lanl.gov
Mon Oct 23 14:11:36 AEST 1989
>From article <1989Oct21.071319.8839 at utzoo.uucp>, by henry at utzoo.uucp (Henry Spencer):
> [...] The whole purpose of && and || is to force
> conditional evaluation, and hence evaluation order.
No, the effect these operators have on evaluation is only part of their
"whole purpose". The also happen to be infix operators which invoke
boolean functions of two arguments. The functions are, mathematically,
commutative and associative. It is not, necessarily, a good idea for
the language to supress these characteristics - you loose a considerable
number of opportunities to optimize. Some studies I've seen in the
literature recommend that the boolean operators should _not_ force
evaluation order. I have no particular opinion on this issue except
that I am not satisfied with the loss optimization, but I wouldn't be
satisfied without a way to force order either - can't have both (or
can you? I know of an experimental language with both).
> [...] I have no objection
> to operators whose specific purpose is to force order, when they are
> broadly useful. [...]
It is obviously a completely subjective question about what order forcing
syntax is "broadly useful". As I've pointed out numerous times in this
discussion, I favor giving the user the option - at least - of explicitly
specifying the order of evaluation. The specification of the C standard
in such a way that I _cannot_ force explicit evaluation order without
sacrificing efficiency and readibility is what I object to.
More information about the Comp.lang.c
mailing list