From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA32466 for caml-red; Mon, 16 Oct 2000 19:47:04 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA30492 for ; Mon, 16 Oct 2000 17:48:14 +0200 (MET DST) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id e9GFmDL28257 for ; Mon, 16 Oct 2000 17:48:13 +0200 (MET DST) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id IAA05696; Mon, 16 Oct 2000 08:48:06 -0700 (PDT) Date: Mon, 16 Oct 2000 08:48:06 -0700 (PDT) From: Brian Rogoff To: Christophe Raffalli cc: caml-list@inria.fr Subject: Re: Undefined evaluation order In-Reply-To: <39EABE87.53274BB6@univ-savoie.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis@pauillac.inria.fr On Mon, 16 Oct 2000, Christophe Raffalli wrote: > It seems to me that a program making use of evaluation order in function > or constructor application is wrong ! Why? It seems right to me, when you're reading in a file of records or building an AST from a file, or whatever, to depend on the evaluation order when building the data structure. I didn't get surprised, because I know OCaml is right-to-left, but I still find all of that let binding code redundant, especially when the records get long. There is nothing "wrong" about it that I can see, except that some people don't like it in concept. Interestingly, some people really did like it in concept and some of them were teachers who've witnessed beginners stumble over this very issue. > It seems easy to me to add some marking in the type system to detect > expression with side effects ... I thought about this too. Something like Clean's uniqueness types? Maybe in OCaml 4 :) > then one could have a warning (or even > an error :-) when some code depends on evaluation order and then, in > this case only, force left to right evaluation order. What does this mean? That you would have the programmer manually insert lets to force the order, or that the compiler does so automatically? > I am sure I would find some bugs in my programs with such a warning :-) I think the random evaluation order that someone proposed as a test/debugging tool might be easier than a modification of the type system. -- Brian