Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] tail call optimization
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dustin Sallings <dustin@s...>
Subject: Re: [Caml-list] tail call optimization

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