From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q05K4mmL002780 for ; Thu, 5 Jan 2012 21:04:49 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah0FAGMBBk9QRFuw/2dsb2JhbABCggWqeYEFgXIBAQUyAUYQCw4KHBIUDRshE4d8tiSFFYYZYwSVBYpxh0U X-IronPort-AV: E=Sophos;i="4.71,464,1320620400"; d="scan'208";a="138038019" Received: from furbychan.cocan.org ([80.68.91.176]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 05 Jan 2012 21:04:43 +0100 Received: from rich by furbychan.cocan.org with local (Exim 4.72) (envelope-from ) id 1RitYI-0007qN-PJ; Thu, 05 Jan 2012 20:04:42 +0000 Date: Thu, 5 Jan 2012 20:04:42 +0000 From: "Richard W.M. Jones" To: Lukasz Stafiniak Cc: Diego Olivier Fernandez Pons , caml-list Message-ID: <20120105200442.GA17669@annexia.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] Examples where let rec is undesirable On Tue, Jan 03, 2012 at 01:05:39AM +0100, Lukasz Stafiniak wrote: > On Mon, Jan 2, 2012 at 11:37 PM, Diego Olivier Fernandez Pons > wrote: > >     List, > > > > I was wondering if there was any reason not to make "let rec" the default / > > sole option, meaning cases where you clearly don't want a "let rec" instead > > of "let" (only in functions, not cyclic data). > > > >          Diego Olivier > > The default "no-rec" allows for name recycling -- using the same name > for an incrementally transformed value, i.e. to bind the intermediate > results. Name recycling minimizes the cognitive burden: there are less > names to remember in a scope, and differences in names are justified > by differences in purpose of the values. Are there reasons to consider > name recycling a bad style? I had an argument about this with a noted open source developer recently. He was saying that C's approach -- not permitting variable names to be reused within a single function -- was somehow advantageous. From my point of view, having used both languages extensively, OCaml's way is *far* better. So yes, 'let' and 'let rec', long may they be different. Rich. -- Richard Jones Red Hat