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

Rodrigo Kumpera kumpera at gmail.com
Fri Jan 30 22:38:47 EST 2009

Mono support tail calls just like .NET does. And as such, have a peculiar
set of constraints
where it doesn't work.

F# is a particularly bad case as we don't have implemented tail calls under
generic sharing.
Try running with -O=-gshared, it should fix your issue.

But please fill a bug report on that, I'm sure Mark will be glad to take a
look at it. He's our tailcall fan ;)

On Fri, Jan 30, 2009 at 10:38 PM, Jon Harrop <jon at ffconsultancy.com> wrote:

> 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
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20090131/9ab2b084/attachment.html 

More information about the Mono-list mailing list