[Mono-list] Mono does not have tail calls?

Jon Harrop jon at ffconsultancy.com
Fri Jan 30 19:38:21 EST 2009


I had long since held the belief that Mono supports tail calls but when I 
recently came to actually test that I discovered that Mono does not, in fact, 
have tail calls.

Specifically, I ran the following simple test code:

  let even odd n = odd(n+1)

  let odd even n =
    printf "%d\n" n
    even(n+1)

  let (_: int) =
    let rec f n = even g n
    and g n = odd f n in
    f 0

That runs fine in OCaml and F# on .NET but it leaks stack space until it dies 
on Mono because the tail calls are not handled properly.

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e


More information about the Mono-list mailing list