Re: Let's not BE NP-hard, shall we...?
On Aug 4 2011, Dan Zuras Intervals wrote:
What I am suggesting that there is one known-in-advance-
&-predictable order of evaluation. It is the one that
is written into the source. It is THIS one that is
reliably & efficiently computable, albeit with a big
hit in parallelism.
Most languages have either a specified or implied
order of evaluation. That's the one that's predictable.
Do they? Of the dozens that I am familiar with, only Java explicitly
specifies the order of evaluation. Most of them specify the operator
precedence, but that is a syntactic concept and not a semantic one.
Some people have attempted to rewrite history by claiming that the
semantic order is required to follow the syntax, but that has NOT
achieved consensus (for good reasons) except in a few languages like
Java.
I am aware that Fortran specifies that the order of
evaluation is effectively NOT specified. I am also
aware that, while it IS specified in C, it is also
routinely ignored.
That's misleading. It is EXPLICITLY unspecified for Fortran, and its
'specification' for C is (at best) of doubtful status. I was involved
in WG14 during the standardisation of both C90 and C99 and took a
particular interest in this area.
It was not there in K&R C.
In C90, it was deliberately left ambiguous in the normative wording,
as there was no consensus. The opponents took their eye off the ball
during the writing of the Rationale, which was written by its
proponents, so it IS there, but the Rationale is merely informative
(as well as being erroneous in its claims of what Fortran states).
In C99, it was made normative together with a huge amount of other
numeric chaos, and is one of the reasons that half of the C-using
community has rejected C99 and is continuing to use C90. And I don't
mean just end-users - I am referring to derivative standards and major
application development.
I don't know the solution. Perhaps the language
committees will accept that there must be a specified
& obeyed order of evaluation for INTERVAL expressions.
Perhaps not. I know some of these guys but I haven't
discussed it with them. Perhaps some of you can ask
them for us.
I am one. While I cannot speak for WG5, I did raise that issue with
some people about 754, and got the expected response. No way, Jose!
It is so radically incompatible with Fortran's expression evaluation
model that I can't see how it could be shoehorned in, even if the will
were there.
Regards,
Nick Maclaren.