[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clause 10, Expression Evaluation



Malcolm Cohen <malcolm@xxxxxxxxx> wrote:

Each programming languages shall specify one or more rules for expression
evaluation. A rule for expression evaluation specifies:
. the order of evaluation of operations,
 
What if it doesn't?
 
The oldest and most successful numeric programming language standard does
not now, to my knowledge has not for 30 years, and to my belief never.

I can push that back to 40 years.  Fortran 66 section 6.4 is clear
and explicit, not just that the order may be anything that is
mathematically equivalent, including associativity and the omission
of parts of an expression if it is not needed.

The last operation of many expressions is an assignment
 
Not in non-expression languages it's not.  Assignment is not an expression
operation in Fortran, Pascal, Ada (IIRC), ...
 
Why do I keep getting the feeling that when some people talk about
  "language neutral specification"
or
  "language independent API"
they mean "C language specification" and "C API".
Not all languages are a mere syntactic variation on C,
nor should they be.

To be fair, it also applies to Algol 68, Genstat and quite a few
other languages, most of which few people will ever have heard of.

It isn't actually correct, even for C, incidentally.  The ordering
of actions in a C statement is something which has caused mayhem,
only just short of turning into physical violence.  That is not an
exaggeration, either.  Even in a simple 'assignment' statement, the
assignment need not be the the last action (and very often isn't).


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1@xxxxxxxxx
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

754 | revision | FAQ | references | list archive