From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q02MoMni024095 for ; Mon, 2 Jan 2012 23:50:22 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiwEAOIzAk/RVda2kGdsb2JhbABDggWqTQgiAQEBAQkJDQcUBCGBcgEBAQQSAiwBOAEDDAEFBQsNLiEBEgEFARwGEwgaoAMKjlCDeokwAgULjAQEiDeMS4pvgw49gU2CSw X-IronPort-AV: E=Sophos;i="4.71,446,1320620400"; d="scan'208";a="125339436" Received: from mail-tul01m020-f182.google.com ([209.85.214.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 02 Jan 2012 23:50:21 +0100 Received: by obbwd18 with SMTP id wd18so21641528obb.27 for ; Mon, 02 Jan 2012 14:50:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=NtTMwY4IO+tmszbEN90VHo53Y+nKs8loZwZBQCj7xW8=; b=aPg/qwAnBUjzRchDdwXPpfRMK+RsyVyboNrwqMeqO8K1bgAi6yA/BBaxyOrt/s4WTO /lRltF2Jdo441rtyYI8zHZjkUuFTnufxhNmRGPC8MuICyUXGFp5ITBCnoD3YRLhO5XHU 2rpnt84cVPqillrCifEbUGUcOMgSnZFxCMnPk= Received: by 10.182.117.8 with SMTP id ka8mr7459678obb.73.1325544620214; Mon, 02 Jan 2012 14:50:20 -0800 (PST) MIME-Version: 1.0 Sender: dapilki@gmail.com Received: by 10.182.216.99 with HTTP; Mon, 2 Jan 2012 14:49:59 -0800 (PST) In-Reply-To: References: From: Alexandre Pilkiewicz Date: Mon, 2 Jan 2012 17:49:59 -0500 X-Google-Sender-Auth: X2fiLzDwWwJVejDjLUCUC4qf1IA Message-ID: To: Diego Olivier Fernandez Pons Cc: caml-list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id q02MoMni024095 Subject: Re: [Caml-list] Examples where let rec is undesirable Hi Diego. I think one of the best reason to *not* have let rec as the default is shadowing. Say you have a function that expect a string as an argument let foo s = .... .... and you realize that it's the job of the callee and not the caller to check that the string is escaped. You can just change it to: let foo s = let s = escape s in .... .... And before you say "let's just do this for function and not for other values", let's remember that nothing separate a function from a value syntactically (it's a functional language, a function *is* a value), only typing can. And you can't type your program before you know its structure, and let vs let rec is part of the structure. Then on top of that we can add that it makes compilation faster, optimization easier, and code clearer (and, of course, backward compatibility :))! Cheers Alexandre On Mon, Jan 2, 2012 at 5: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