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
Parameter evaluation order
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-08-26 (09:53)
From: Christophe Raffalli <christophe.raffalli@u...>
Subject: Re: [Caml-list] Re: Parameter evaluation order

 > The examples that bother me most are record constructors, where I want to
 > read structured data from a file into a record. And of course :: 
(which is
 > just sugar) too.

I did not know and completely agree with you:

# type test = { a : int; b : int }
type test = { a : int; b : int; }
# { a = (print_string "a"; 1); b = (print_string "b"; 2)};;
ba- : test = {a = 1; b = 2}

This looks strange, because the semicolumn is used both to specify order 
evaluation left-to-right in sequence and right-to-left in record.

And the pb of function application is not there, you could evaluate with 
the same efficiency record in any order, you know the number of 
arguments and what you should do with them at compile time.

Moreover, if you want to unify record and modules ... then you have no 
choice, no body wants right-to-left (I should say bottom-to-top :-)
evaluation order in modules :-)