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
Re:Tail Calls
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-03-16 (01:38)
From: Marc Hamann <marc@h...>
Subject: Re:Tail Calls

>I don't understand why the compiler don't do himself those transformations.
>Why is it so hard to take a non-tail-recursive-function and make it a 
>tail-recursive-one ?

Because in the general case that would change the intent of the program.

Imagine if you have a sequence of two expressions with side-effects, or 
with significant order (e.g. consing a value to a function that returns a 
list).  Changing the order automatically would have the wrong effect.

Boy, some people want computers to do ALL our thinking. ;-)