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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 2DD67BC0A for ; Sat, 19 May 2007 23:55:23 +0200 (CEST) Received: from smtp.syd.people.net.au (smtp.syd.people.net.au [218.214.225.98]) by discorde.inria.fr (8.13.6/8.13.6) with SMTP id l4JLtJnG021513 for ; Sat, 19 May 2007 23:55:22 +0200 Received: (qmail 3322 invoked from network); 19 May 2007 21:55:19 -0000 Received: from unknown (HELO hendrix.mega-nerd.net) (218.214.64.136) by smtp.syd.people.net.au with SMTP; 19 May 2007 21:55:19 -0000 Received: from hendrix (hendrix [192.168.200.99]) by hendrix.mega-nerd.net (Postfix) with SMTP id CFFFE2FED6 for ; Sun, 20 May 2007 07:55:17 +1000 (EST) Date: Sun, 20 May 2007 07:55:17 +1000 From: Erik de Castro Lopo To: caml-list@inria.fr Subject: Re: [Caml-list] tail rec Message-Id: <20070520075517.a826e77d.mle+ocaml@mega-nerd.com> In-Reply-To: References: <1179543365.26755.33.camel@rosella.wigram> <464E8B1B.7080800@starynkevitch.net> <1179579512.18119.36.camel@rosella.wigram> Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed 2.3.1 (GTK+ 2.10.11; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 464F7247.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 compiler:01 syntax:01 syntax:01 iterative:01 wrote:01 rec:01 compile:01 caml-list:01 tail:01 tail:01 let:03 let:03 erik:04 erik:04 Jonathan Bryant wrote: > Does the compiler optimize the calls (f x) and (g x) into tail > calls? If so, how would the > > let railrec f x = ... > let tailrec g x = ... > let tailrec h x = ... > > syntax handle/help this? Or would it hinder it? The new syntax neither helps nor hinders. The tailrec directive requests that the compile complain if a function marked as "tailrec" cannot be made tail recursice. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "I have found that Big Design Up Front environments attract people who want to talk about software development, while iterative environments attract people who want to develop software. Is it any surpise that in companies where BDUF is predominant, nobody wants to stoop to coding? Everyone wants to be an 'architect' or a 'Business Analyst' or a 'Product Manager'." -- Reg Braithwaite