From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA16632 for caml-redistribution@pauillac.inria.fr; Fri, 17 Mar 2000 17:21:58 +0100 (MET) Resent-Message-Id: <200003171621.RAA16632@pauillac.inria.fr> 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 RAA23959 for ; Fri, 17 Mar 2000 17:09:02 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id RAA28602; Fri, 17 Mar 2000 17:09:01 +0100 (MET) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA28559; Fri, 17 Mar 2000 17:08:57 +0100 (MET) Message-ID: <20000317170857.64628@pauillac.inria.fr> Date: Fri, 17 Mar 2000 17:08:57 +0100 From: Pierre Weis To: Jacques Garrigue Cc: caml-list@inria.fr Subject: Re: Syntax for label, NEW PROPOSAL References: <20000317093058.30145@pauillac.inria.fr> <20000317230543D.garrigue@kurims.kyoto-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <20000317230543D.garrigue@kurims.kyoto-u.ac.jp>; from Jacques Garrigue on Fri, Mar 17, 2000 at 11:05:43PM +0900 Resent-From: weis@pauillac.inria.fr Resent-Date: Fri, 17 Mar 2000 17:21:58 +0100 Resent-To: caml-redistribution@pauillac.inria.fr > There may indeed be good reasons for let-binding. > However, if you look at the sources of ocaml, you will see that in > many, many places such functions are defined inline without > let-binding. I see two reasons for that: > * you often don't want to think of a name for such a function > (most of them are just 2 or 3 line long) Is this argument relevant to the problem at hand ? You were speaking of the advantage of using a label fun: for applying map to a ``long multi line function definition'': > fun:(fun long multi line function definition here) If the function is ``long'' and multi line, I definitively prefer a let binding. If it is not ``long'' I prefer no label and a short and elegant (fun x -> ...). > * it forces you to move the code around in a way that is not > necessarily very natural. It's a bit like RPN: first define a > function, then apply a functional to it. > (We could of course ressucite the where clause :-) Yes that's fundamentally the way it goes in Caml: define first something then use it (static binding). I'm sorry, we removed the where construct a long time ago exactly with this argument. As you say below ``More generally, my experience is that'' * once anonymous functions are named, the code is clearer * when anonymous functions are ``long multi line'' the code is obscure. > More generally, my experience is that more freedom in the way to > layout them increases the use of functionals. After all there are many > ways to see the same function, different logical understanding of its > meaning. And the fact you can use all these ways with the same function > avoids confusion. > Why should we decide that one way is right, and others are wrong? You already answered to this question in your paragraph: I would answer in the first place with the very reasons you are advocating to ask why we should decide; you wrote ``my experience'', ``logical understanding'', ``avoids confusion''. So, we should decide that one way is right based on experience, theorems, confusion avoidance, logical understanding, .... Amicalement, -- Pierre Weis INRIA, Projet Cristal, http://pauillac.inria.fr/~weis