From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA21881 for caml-redistribution; Wed, 15 Dec 1999 22:15:34 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA30660 for ; Wed, 15 Dec 1999 11:05:36 +0100 (MET) Received: from jaune.inria.fr (jaune.inria.fr [128.93.11.80]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id LAA24160 for ; Wed, 15 Dec 1999 11:05:35 +0100 (MET) Received: (from ddr@localhost) by jaune.inria.fr (8.8.7/8.8.7) id LAA20876; Wed, 15 Dec 1999 11:04:53 +0100 Message-ID: <19991215110453.C20737@jaune.inria.fr> Date: Wed, 15 Dec 1999 11:04:53 +0100 From: Daniel de Rauglaudre To: Norman Ramsey , caml-list@inria.fr Subject: Re: my stupidity and non-tail calls References: <199912141953.OAA04635@labrador.eecs.harvard.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 In-Reply-To: <199912141953.OAA04635@labrador.eecs.harvard.edu>; from Norman Ramsey on Tue, Dec 14, 1999 at 02:53:18PM -0500 Sender: weis > OK, I apologize for bothering everyone. My `tail calls' are actually > sitting inside `try ... with' blocks, so I recognize that these cannot be > optimized since they are in the scope of different handlers. I will > have to find a way to restructure my code. A great pity, since > I like it the way it is... suggestions are welcome. To resolve this problem, instead of: try let x = exp in f x with Exception -> y you can use the equivalent (but the call to "f" is tail): match (try Some exp with Exception -> None) with Some x -> f x | None -> y I use that thousands of times in my code, when needed. -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/