google-code-export / unquote

Automatically exported from code.google.com/p/unquote
Apache License 2.0
1 stars 1 forks source link

Support tail recursion #97

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
let tailTest =
  <@   let rec sum a b = if a > 0 then sum(a - 1) (b + 1) else b
       sum (1024*1024*128) 0 @>
tailTest.Eval()

should work without StackOverflowException

Original issue reported on code.google.com by lostfree...@gmail.com on 28 May 2012 at 2:08

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 29 May 2012 at 4:01

GoogleCodeExporter commented 9 years ago
Hi @lostfreeman,

Just want to let you know that I am definitely keen on fixing this issue. But 
after some investigation, I fear it is near-impossible to implement within the 
framework of Unquote's reflection-based compiler. I think the F# team would 
have to build support for tail recursion into their F# reflection API for this 
to work. Indeed, this might be consider a bug in FSharpValue.MakeFunction, 
which is what we use to make F# functions from Lambda expressions.

Original comment by stephen....@gmail.com on 14 Oct 2012 at 3:35