Hi,
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?
I remember some discussion of this but I couldn't find it in the Caml list
archives.
Besides being surprising for lots of people, it is actually a little
ugly to have to write explicit let bindings to force the order and when
reading files which consist of long records; for instance I much prefer
type date =
{ year : int
; month : int
; day : int
; hour : int
; minute : int
; second : int
}
let input_date igds =
{ year = input_word igds
; month = input_word igds
; day = input_word igds
; hour = input_word igds
; minute = input_word igds
; second = input_word igds
}
to
let input_date igds =
let year = input_word igds in
let month = input_word igds in
let day = input_word igds in
let hour = input_word igds in
let minute = input_word igds in
let second = input_word igds in
{ year = year
; month = month
; day = day
; hour = hour
; minute = minute
; second = second
}
or even with right-to-left where the order is exactly the opposite of the
record definition (and of what most readers expect).
-- Brian