From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA27692; Wed, 19 Nov 2003 18:46:34 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 SAA27817 for ; Wed, 19 Nov 2003 18:46:32 +0100 (MET) Received: from bob.west.spy.net (mail.west.spy.net [66.149.231.226]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hAJHkT127604 for ; Wed, 19 Nov 2003 18:46:31 +0100 (MET) Received: from [10.9.254.240] (sjc-dist3-e3.2wire.com [63.203.253.2]) by bob.west.spy.net (Postfix) with ESMTP id C9D8A5BB0; Wed, 19 Nov 2003 09:45:39 -0800 (PST) In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v606) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <301163CA-1AB8-11D8-A4B7-000393CFE6B8@spy.net> Content-Transfer-Encoding: 7bit Cc: Caml Mailing List From: Dustin Sallings Subject: Re: [Caml-list] tail call optimization Date: Wed, 19 Nov 2003 09:45:39 -0800 To: Brian Hurt X-Mailer: Apple Mail (2.606) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 compiler:01 compiler:01 nov:01 exception:02 exception:02 stack:02 thread:02 wrote:03 tail:03 tail:03 anyway:05 tricky:06 brian:06 optimization:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Nov 19, 2003, at 9:22, Brian Hurt wrote: > What would happen if f just happened to throw an End_of_file exception? > Not to mention the fact that it's tricky for the compiler to determine > that the call to fold_lines can't throw an End_of_file. So the > compiler > just assumes that both might, and thus has to keep the try/catch block, > and the context (stack frame) of the function, alive until both are > complete. Ooh, this is the key, the compiler doesn't know that that exception can't be thrown. This goes back to exception handling thread from earlier, I think. If the compiler knew the exception wouldn't be thrown, then the tail call optimization would be possible. Anyway, I think this clears up my confusion, thanks. -- Dustin Sallings ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners