Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Evaluation Order
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-06-13 (09:55)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] Evaluation Order
Brian Rogoff wrote:

> > Perhaps binding record fields left to right makes sense,
> And tuples, and (::), and ...
> Why not make the default correspond to everyone's intuition?

	It may clobber performance, and, it isn't
all that obvious anyhow.

	Here is the 'classic' example from C:

	x[i++] = y[i++]

[If you think you know the answer .. just consider that
i might alias x :-]

If the order of evaluation is strictly specified,
a lot of results must be written to memory
prematurely. It is one reason why C is slower than Fortran.
I suspect it is processor dependent.

	C specifies sequence points: places where
write operations must be completed before continuing.
If you do a read before that, the result is indeterminate.
The rules try to make efficient 'in register' operations
possible and allow enough flexibility to reorder
instructions to suit a processors caching and pipelining
model --  while still making common idioms work.

	I'm no expert. I simply advise caution here.
_Functional_ expressions can be optimised in useful
ways at very low processor dependent levels.
Lets not stop the Ocaml team trying to beat both
C _and_ Fortran!

John (Max) Skaller,
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper
download Interscript
Bug reports:  FAQ:
To unsubscribe, mail  Archives: