From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA06991; Wed, 21 Jan 2004 20:29:02 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA06908 for ; Wed, 21 Jan 2004 20:29:01 +0100 (MET) Received: from dali.cis.ru (dali.cis.ru [212.109.192.9]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i0LJT0v00820 for ; Wed, 21 Jan 2004 20:29:00 +0100 (MET) Received: from max1.home (pax2-7.cis.ru [212.109.194.7]) by dali.cis.ru (8.12.2/8.12.2/dali-2.0) with SMTP id i0LJSvkh043943 for ; Thu, 22 Jan 2004 01:28:58 +0600 (NOVT) Received: (qmail 2887 invoked by uid 100); 21 Jan 2004 19:07:58 -0000 Date: Thu, 22 Jan 2004 01:07:58 +0600 From: Max Kirillov To: Ocaml Mailing List Subject: Re: [Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch Message-ID: <20040122010758.A2878@max.home> Mail-Followup-To: Ocaml Mailing List References: <20040116093454.GA23909@redhat.com> <200401192345.10735.exa@kablonet.com.tr> <20040120173423.GA19476@roke.freak> <200401201952.56605.exa@kablonet.com.tr> <20040120185445.GA26921@roke.freak> <20040120193756.GA25813@davidb.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20040120193756.GA25813@davidb.org>; from caml-list@davidb.org on Tue, Jan 20, 2004 at 11:37:56AM -0800 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; kirillov:01 caml-list:01 2004:99 haskell:01 c's:01 cryptic:01 predictable:01 camlp:01 haskell:01 ocaml:01 caml:01 readable:01 readable:01 side-effects:02 patch:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Jan 20, 2004 at 11:37:56AM -0800, David Brown wrote: > The where clause works well for Haskell, because there are no order of > evaluation issues. Because of side-effects, the where clause in ocaml > would usually just end up being confusing. Think of a multi-page > expression with a where clause at the end. Not that this is good code, > but it would sure be easy to miss. It would probably cause the same > kinds of problems that C's 'break' causes in switch statements. If you want to make your code cryptic, no language feature (or lack of one) can prevent you from that. "Where" construction is a powerful way to make code more readable, placing it in "top to bottom" style. You noted that placing actual computation in where block can hinder the evaluation order. Then don't place the computation in "where" block! Let's rewrite your example like this: let _ = let x = g () in f x where g () = ... Here, no uncertainty about evaluation order left. PS: You are right about scoping. But it's not critical -- it we could have certain rules, we coul write predictable and readable code. Some time ago, I used my own realization of "where" (via camlp4) and often had to use brackets. Even then, I think that my code was quite readable. Now, I think than haskell rules (whare as part of definition, not expression) are quite rasonable. > Dave Brown -- Max ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners