Browse thread
Undefined evaluation order
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Brian Rogoff <bpr@b...> |
| Subject: | Re: Undefined evaluation order |
On 8 Oct 2000, David [iso-8859-1] Mentré wrote: > Brian Rogoff <bpr@best.com> writes: > > > It is well known that OCaml has undefined evaluation orders and that > > it uses right-to-left ordering. What is the rationale for that decision? > > It is linked to the way the bytecode is designed to optimize functions > evaluation. You'll find a detailed (and more accurate) explanation in > the following paper : > > RT-0117 The ZINC experiment : an economical implementation of the ML > language - Xavier Leroy > http://www.inria.fr/RRRT/RT-0117.html Thanks David, that's exactly the kind of explanation I was looking for. Interestingly, I had a discussion with my manager about this and we had slightly different views. I argued that evaluation order should be specified and that it should be left-to-right, which I hope everyone agrees is the most natural order. He argued that evaluation order should be defined so that you can analyze programs, but that the order was irrelevant; he'd be happy with right-to-left if it were specified. For OCaml it appears that the perspective adopted is that the programmer must make the temporal dependencies explicit. The reason is for (bytecode) compiler optimizations, but it is mentioned that this usually leads to clearer programs. I'm sure the bytecode compiler argument is valid, but not the code clarity one, since it sounds similar to an argument that having uninitialized variables is clearer since it forces you to make values explicit, and I don't believe that. -- Brian