lua-users home
lua-l archive

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

Mike Pall wrote:
> Open source doesn't come with any guarantees -- this applies to
> release dates, too. :-) In your case you could just use Lua+Pluto
> and upgrade later.

Was planning on doing that anyway. Lua is still pretty fast, just
substantially faster using LuaJIT 1.x (and as I understand it, even
faster again in LuaJIT 2.x). I wasn't after a guarantee of any form,
just curious if you came across something that will "guarantee" it won't
happen by the end of the year. I am often a victim of my own
"time-estimate optimism", so I know this can happen (in my case, more
often than I'd like).

> But a question remains: why are you going for coroutine persistence?
> It's a charming solution for sure. But most people who went down
> this road sooner or later had to realize that this approach is
> quite restrictive. The data dependencies between coroutines and
> shared state can become quite complex. Explicitly saving only the
> necessary state is often the better solution. Also think about
> migration of saved state between software versions, editing saved
> state or debugging saved state (oh dear).

Actually, this is something I've been looking at. I initially was
looking at Erlang for this, but it doesn't allow pausing/persisting all
processes at once (it was after all designed for real-time server
development). Erlang gets around this state dependency problem in two
ways: no shared state, and explicit module/function lookup. The no
shared state thing is something I think I can get around to some degree
as I am using Lua for "agents" only with message passing as the
communication mechanism. Upgrading object state is also possible using
the pluto "persist" metatable option (passing in a function that can
also upgrade from a previous version).

The issue as I see it is being able to persist multiple versions of the
same function. Erlang allows for there to be two "active" copies of a
module loaded & running at the same time. When the code explicity calls
"module:function(...)" rather than "function(...)", the new function
will be looked up and the parameters passed to it. This basically allows
the Erlang code to keep running until it calls another function or
iterates over another loop (in tail-call fashion). It would be nice if
Lua could do this, and I'm looking into how it might be possible.

--B Tolputt