On Saturday 20 December 2008 06:29, verec wrote:
> At about 72:54 of the clojure sequence talk, Rich explains that he
> doesn't want to provide "false guaranties" to people used to "true
> tail calls" even though he could detect such "tail position calls"
> and basically transforms them into what recur currently does.
>
> I'm just curious about examples where such a "magic transformation"
> would result in violated assumptions.

Write some Clojure code and use recur freely, without regard to whether 
it's in tail position and the compiler will tell you when it's not.

Though I don't know where "magic" does or would enter the picture.


> If the detection of the tail call position is not too involved,
> (after all, detecting that recur is in tail position seems simpler
> than detecting that an arbitrary function call is) I fail to see what
> the problem is.

The problem is that if local bindings are needed after the recursive 
call returns then a new stack frame must be created for that recursive 
call. If not, the local bindings may be abandoned (or, more to the 
point, reused) and the stack need not grow to accommodate the 
recursion. In the tail-call case (explicitly requested by the 
programmer and validated by the compiler), the "recursive call" becomes 
rebinding of the locals followed by a "go-to."


> Anyone cares to elaborate?


> Many Thanks


Randall Schulz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to