[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Re: implementing a future in lua
- From: "李慧霸" <magazine.lihuiba@...>
- Date: Sat, 3 Jan 2009 20:44:32 +0800
>Coco's probably the best solution, but if you prefer to keep ansi c there is the
>http://lua-users.org/wiki/ResumableVmPatch. Or perhaps do away with the
>metamethods idea and modify c side, but it still won't be easy/neat. Good luck :).
I prefer coco to ResumableVmPatch. Because (1)ansi c is not a aim for me at all,
and the detail of an improved coroutine is almost orthogonal to future, and (2) a
JIT-able future is more desirable :)
I have the following design decisions:
(1)compatibility with existing lua code. exising lua code should run as expected
with future variables. There's no need to distinguish between a future and others
most of the time.
(2)compatibility with existing c code. extension modules need not to be modified.
(3)a clean and non-intrusive implementation
Actually I have done some trivivial work and got a bit familiar with lua source code.
I find it very difficult to get a non-intrusive implementation. I have to modify
everywhere when a varialbe value is used, because I don't see there's an abstraction
with which I can intercept an access to a variable and distinguish between reference
passing or content reading/writing. Is there any suggestion?