lua-users home
lua-l archive

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




> First off, let me say I'm excited to see CSP coming to Lua. I've only
> really played around with Go's implementation of CSP (which doesn't
> strictly follow the original CSP IIRC.) It will be nice to play around
> when I finally get this compiling[1].

Yeah, there is Microsoft Visual Studio 2010 solution only (for now).
Sorry about that. Portability and cross-platform support are on the way :)

> Now without having actually compiled and tested it, it sounds like it's
> using a modified version of Lua 5.2's source code which will produce a
> separate interpreter & library. Assuming that's true, how invasive were
> the changes and how feasible would it be to make it a Lua module
> instead? It could, for instance, build as a module on systems that
> support/want it and build as a library (as a replacement to the standard
> Lua) for those wanting to easily embed it (perhaps there's a better way,
> but it's still morning here, so I'm not going to dwell on it too much.)
>
> [1] GCC isn't currently supported, but I've fixed some of the cross
> platform issues already on my github fork.

Not sure if LuaCSP is useful on it's own. It's more a framework now. You still have to write your "Fundamental Operations"
to get some sense. I have to develop a few high-level samples, maybe.

I tried to escape invasive Lua changes as much as possible (as mentioned in Implementation Disclaimer section of the doc).

The only change in Lua 5.2.1 provided in LuaCSP repo is the usage of float for LUA_NUMBER.
Moreover, this is a separate complaint: simple substitution double -> float for LUA_NUMBER spawns many
errors and warnings in MSVC 2010. This wasn't that bad for Lua 5.1. I was forced to fix all the issues myself.
So, it should work with standard Lua except some warnings in regard to float<->double conversions.

There is a requirement for LuaCSP: Lua has to be compiled with:
#define LUAI_EXTRASPACE sizeof(void*)

The reason for this is to provide extremely fast mapping from lua thread to my custom C++ object.

I used to replace thread's global environment in Lua 5.1 but it's not that fast and doesn't work in Lua 5.2 anymore AFAIK.
Any suggestions?

Basically, it's quite easy to fix once I find efficient way of mapping thread->void* on unmodified lua. I'm going to provide that feature under
extra #define in LuaCSP config.

Alexey.