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 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 3B4B4BC69 for ; Sat, 21 Oct 2006 16:00:08 +0200 (CEST) Received: from smTp.neuf.fr (sp604003mt.neufgp.fr [84.96.92.56]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9LE07IV026190 for ; Sat, 21 Oct 2006 16:00:08 +0200 Received: from [192.168.144.231] ([84.5.234.181]) by sp604003mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0J7H00355O85XMC1@sp604003mt.gpm.neuf.ld> for caml-list@inria.fr; Sat, 21 Oct 2006 16:00:05 +0200 (CEST) Date: Sat, 21 Oct 2006 16:00:11 +0200 From: Christophe Raffalli Subject: try and tail call To: caml-list@inria.fr Message-id: <453A27EB.8070609@univ-savoie.fr> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT User-Agent: Thunderbird 1.5.0.7 (Macintosh/20060909) X-Miltered: at discorde with ID 453A27E7.003 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 raffalli:01 raffalli:01 univ-savoie:01 syntax:01 usefull:01 bug:01 avoided:01 christophe:01 encode:01 exception:01 tail:01 tail:01 handles:03 let:03 consider this piece of code: (try let b = f a in (fun () -> g b) with (fun () -> h a)) () Is the call to "g" a tail call and is it omptimized as such ? If not, how to encode a feature like this one: try ... end ... (* the exception raised here are not handles by with but propagated *) with ... By the way I think this "try ... [end ...] with ..." syntax is usefull anyway because you have often a bug when you write try let b = f a in (* you know this may raise Not_found *) g b (* you assume wrongly that this can not raise Not_found *) with Not_found -> h a The unwanted capture of Not_found could be avoided with try ... end ... with ... Christophe Raffalli