From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id EF26FBC0A for ; Mon, 21 May 2007 16:00:14 +0200 (CEST) Received: from smtp.janestcapital.com (www.janestcapital.com [66.155.124.107]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4LE0Djh011185 for ; Mon, 21 May 2007 16:00:14 +0200 Received: from [172.25.129.161] [38.96.172.125] by janestcapital.com with ESMTP (SMTPD-9.10) id A5F502F4; Mon, 21 May 2007 10:00:21 -0400 Message-ID: <4651A5EA.8080702@janestcapital.com> Date: Mon, 21 May 2007 10:00:10 -0400 From: Brian Hurt User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Robert Fischer Cc: caml-list@inria.fr Subject: Re: [Caml-list] tail rec References: <1179543365.26755.33.camel@rosella.wigram> <4651973F.9010503@janestcapital.com> <465198E5.3010004@SmokejumperIT.com> <20070521152116.70d642b0.basile@starynkevitch.net> <46519EDF.5060505@SmokejumperIT.com> In-Reply-To: <46519EDF.5060505@SmokejumperIT.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4651A5ED.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; annotation:01 recursive:01 emacs:01 recursion:01 beginner's:01 experimented:01 ocaml:01 recursive:01 recursion:01 wrote:01 imho:01 rec:01 compile:01 typing:01 caml-list:01 Robert Fischer wrote: > >> I'm repeating my suggestion: extend the typing annotation (produced >> by -dtypes) to flag every tail recursive call, and have the emacs >> mode and ocamlbrowser display every tail call particularily (e.g. in >> a different color or font). >> >> This don't require any additional language construct. >> > > Oh, then we're cool. :-D > >> Also, tail recursion is IMHO a beginner's puzzle. I'm pretty sure >> every experimented Ocaml programmer does know inside his code what >> are his tail recursive calls. >> > > If you asked me to point them out, I could. If you asked me if a > given function is tail recursive, I could tell you. I also use tail > recursive calls unintentionally, and (while I realize now that you're > not proposing this) I was concerned my code suddenly wouldn't compile > because I didn't happen to tag a tail recursion. Most of the time you don't care wether a particular call is a tail call or not. I will comment: in my experience, new programmers make simple mistakes for simple reasons, while experienced programmers make simple mistakes for complicated reasons. Actually, I can see uses for this, even for experienced, knowlegable programmers. For example, I can imagine scenarios where, during maintainance, a try/catch block is introduced, making a tail call that needed to be a tail call into a non-tail call. Opps. I don't think this happens all that often, so it's not that valuable to experienced programmers, but every little bit of correctness helps. Brian