lua-users home
lua-l archive

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

> Lua Lanes handles multithreading essentially as a future (though I
> think that term is not mentioned in its documentation). Lanes are

while designing my Helper Threads Toolkit, i had futures in mind; at least 
conceptually, but didn't make any effort to support the exact syntax.

the main data type in HTT is the 'task', that represents some background 
execution, and would yield a value at some time.  if you try to get it before 
it's done, the Lua thread blocks while waiting for the task to complete.

after a few design rounds, i added queues, so that you could get tasks as 
they're completed, and also the capability for tasks to yield values before 
they're fully finished.  both features diverge from the 'futures' theory, so i 
decided not to call them so .

the 'non-concurrent futures' mentioned by Alex sound like the way lazy 
evaluation is implemented in Scheme in the SICP, or HtDP book (i don't 
remember which one).  the tricky part it to make lazyness contagious, so that 
any expression that tries to evaluate a non-evaluated future becomes non-
evaluated itself.

as far as i recall, that last feature required a new eval loop, reimplementing 
the language on top of itself (a common usage in Lisp lands)