Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr