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.2 required=5.0 tests=AWL,MAILTO_TO_SPAM_ADDR autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 2FE3ABC6B for ; Sat, 4 Aug 2007 14:34:24 +0200 (CEST) Received: from einhorn.in-berlin.de (einhorn.in-berlin.de [192.109.42.8]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l74CYN0J021588 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sat, 4 Aug 2007 14:34:23 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from einhorn.in-berlin.de (localhost [127.0.0.1]) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id l74CYLBD016491 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 4 Aug 2007 14:34:22 +0200 Received: (from www-data@localhost) by einhorn.in-berlin.de (8.13.6/8.13.6/Submit) id l74CYLE4016489 for caml-list@yquem.inria.fr; Sat, 4 Aug 2007 14:34:21 +0200 X-Authentication-Warning: einhorn.in-berlin.de: www-data set sender to oliver@first.in-berlin.de using -f Received: from dslb-088-073-124-108.pools.arcor-ip.net (dslb-088-073-124-108.pools.arcor-ip.net [88.73.124.108]) by webmail.in-berlin.de (IMP) with HTTP for ; Sat, 4 Aug 2007 14:34:21 +0200 Message-ID: <1186230861.46b4724d1561e@webmail.in-berlin.de> Date: Sat, 4 Aug 2007 14:34:21 +0200 From: Oliver Bandel To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Warning on not-tail recursive functions References: <46B45BE3.9040403@menta.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.6 X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 X-Miltered: at discorde with ID 46B4724F.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bandel:01 in-berlin:01 recursive:01 ocamlopt:01 recursive:01 tailcall:01 tail-call:01 tailcall:01 2007,:98 wrote:01 oliver:01 oliver:01 caml-list:01 functions:01 functions:01 Zitat von Brian Hurt : > > > On Sat, 4 Aug 2007, tmp123@menta.net wrote: > > > Hello, > > > > Please, knows someone if "ocamlopt" can print a warning message when a > > recursive function is not tail recursive, and code with the "jmp" > > optimization has not been generated?. > > The problem is that I often write recursive functions which are not tail > recursive, and that's OK. Well, during I've learned on tail-recursion I have habituized to always write functions tailrecursive, so that when I want to try a non-tailrec function, I really have to think a log about it... ...really! It's only a way of what one is used to do very often. If you get accustomed to tailrec function writing, then it's "natural". Before I knew how to write tailrec code, it was the other way around and I had to tjink a lot about how to get it tailrec. [...] > > The rules for what is or is not tail recursive are pretty simple. Boiled > down, they are: > 1) The tail call must not be within a try expression > 2) You can not do anything except return, uninspected and unmodified, the > returned value from the call. What ist with a ... ignore (maybe_tailcall()) ... ??? Does ignore REALLY ignore the values (does not generate them), so that this call is like a true tail-call, or will the maybe_tailcall generate and give back results to the ignore-call and then ignore throws away the stuff (then it would be NO tailcall). Ciao, Oliver