[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] LuaCSP framework: Communicating Sequential Processes in Lua
- From: Harley Laue <losinggeneration@...>
- Date: Tue, 15 Jan 2013 11:05:16 -0600
On 01/15/2013 10:14 AM, Alexey Baskakov wrote:
Like I said, you can check out my fork on github (I'm not going to
bother to submit a pull request unless you really want me to.) I've
already got it compiling (manually with g++.) One thing which might be
useful is using CMake since it can generate MVS solutions as well as
Makefiles (or Ninja builds, which is becoming my preferred builder now.)
Otherwise a plain Makefile is really good enough.
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.
Yeah, there is Microsoft Visual Studio 2010 solution only (for now).
Sorry about that. Portability and cross-platform support are on the way :)
I guess the way I'd /like/ to use it would be two fold (depending on
what I'm writing.) One would be the embedded route which is currently
supported. The other would be more in pure Lua (or using C modules)
being run from the standard Lua interpreter. Some things I'd like to be
able to do:
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.)
 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.
* Use channels and composition to make some code concurrent.
* Write fundamental operations in plain Lua.
What I guess I'd like to be able to write is something like:
Yeah, I figured that out after I decided to untar lua-5.2.1 on top of
the LuaCSP repo and look at the git diff.
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*)
That's good to know. I didn't realize that just from my (quick) look at it.
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.
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.