[e-lang] Q: asynchronous tail recursion?

Kevin Reid kpreid at mac.com
Wed Dec 27 08:21:32 CST 2006


On Dec 27, 2006, at 5:22, Constantine Plotnikov wrote:

> Is tail recursion supported for asynchronous loops in E? My current
> guess (based on E.send*() API) that tail recursion for asynchronous
> processes is not supported for loops that return a value and it cannot
> be supported unless changes to API and to kernel E expansions are
> made.

*If* this is in fact a problem, which I'm not sure about, then I  
think it can be fixed as part of the implementation: any time a  
promise is resolved to another promise, the resolved-ref should do a  
whenMoreResolved on its target, changing its target whenever it gets  
a response. This would ensure that there is at most one layer of  
resolved promise in any such resolution chain.

> ...
> def handleConnections(serverSocket, servlet) : vow {
>   def [rc, resolver] := makeVow()

makeVow() should be Ref.promise().


-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the e-lang mailing list