Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2003-11-19 (17:46)
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 Archives:
Bug reports: FAQ:
Beginner's list: