lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi, 

Sorry to reply so late. I don't have freqent Internet access.

As what VSP said, it is used for Asynchronious communcations, without
callbacks however. In my opinion, the term "concurrency" here doesn't
involve any parallelism, or so-called "true concurrency". So what I'm
using is coroutine.

Alex mentioned using metamethods (thanks for your adivce). But I have
encountered a problem with this approach: yielding across them. Suppose
we have a function like:
function foo(a,b)
  return a+b
end
If we pass a undeterin future variable to this function, the expression
a+b would have to yield to wait for the future's determination. Yielding
across metamethods seem not to be supported. In contrast, lanes doesn't
need to yield, they just block to wait for results from other preemptive
threads.

I want future to be as transparent as possible, existing modules (at least
lua code) that doesn't take future into account should work properly with
it. So I'm reading and modifying the source code of lua. But the biggest
problem I think is yielding. Transparent future may yield everywhere, but
current VM implementation doesn't allow this. Maybe coco is the solution.

------------------				 
lihuiba
2009-01-02