tags:

views:

163

answers:

3

For those that have glanced through the lua C VM implementation.

Would the use of C++ significantly simplify the implementation?

Thanks!

+4  A: 

Lua is intended to be an embedded language. So the "implementation" of the VM comes in two distinct pieces: the creation of the VM source code, and the integration of that code in the artifact to be deployed. I suspect your question is intended to focus on the first part. Too bad. The second part, the integration, happens many times over, and is generally much easier in C than in C++.

Doug Currie
+10  A: 

For years, genius-level engineers have sweated blood over that VM to make it as simple as possible while remaining extremely portable (any ANSI C compiler) and highly performant (look at any comparative measure of scripting languages). Next to that kind of effort, I don't see how C++ can simplify anything. In fact, with C++ I'd worry about the language obscuring important properties like the cost model.

Norman Ramsey
A: 

Anything C can do, C++ can do better. I always thought that the Lua source was pretty damn hard to read - gave some warnings on 64bit, although it seemed to be OK.

The trouble is that the whole userdata thing, it's really not very good for exposing new types to. I'd look at a redesign rather than a reimplementation.

DeadMG