That kind of coding is easily modelled by returning closures to a core event 
loop routine.

Sebastian Sylvan wrote:
> A counter-point is that those are the cases that could usually be
> rewritten as a loop anyway. The cases where tail-calls are
> indispensible are things like having a long running "server process"
> that branches on incoming messages and "jumps" to different states by
> tail calling to the appropriate function. Without tail calls that
> would have to be obscured behind an explicit model of a state machine
> or a gigantic monolithic switch statement in a loop, or something,
> making the code significantly harder to write/read/maintain.
>
> On Mon, Aug 1, 2011 at 7:23 AM, Noel Grandin <[email protected]> wrote:
>> True, but the 99% case for tail-called functions is where the tail-caller, 
>> and the tail-callee are the same function.
>> So, sure, we don't have all the power of classical tail calls. But we have 
>> lots of other power to compensate for it :-)
>> And we can support the majority use-case at the cost of some compiler 
>> complexity.
>>
>> Marijn Haverbeke wrote:
>>> Ah, I see what you mean now. But this kind of rewriting requires
>>> knowledge of the tail-called function (which may be in another module,
>>> or passed in by value), and a bunch of extra complexity. It doesn't
>>> really have the elegance of classical tail calls.
>> _______________________________________________
>> Rust-dev mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/rust-dev
>>
>
>

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to