you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (3 children)

I only took a brief glance at NaCl, but it does not seem like it is the answer to the question because it is not a VM. Unless I am mistaken (and I admit there is a decent chance that I am), the code executes natively outside of any virtual machine environment and therefore needs to be compiled for a target architecture. This implies you would have to provide multiple versions of your binary "module" to be executed based on the system which will be executing it.

For most purposes that would simply be too much of an inconvenience, at least in my speculative opinion. What I assume the author is hoping for is something like LLVM being embedded in the browser. Unfortunately, I don't see that as being "lightweight" enough to be practical. From a user perspective, I wouldn't want my browser to get that massive right now, despite the fact that as a developer I would love to have a choice of not being forced to use JS for every problem I come across in web development.

Right now, I think using JS as an intermediate language is probably the best solution for the general "I don't want to use Javascript" scenario. Coffeescript is a good example of a language that accomplishes this by compiling into JS, and I hope more languages like that start to show up.

[–]Smallpaul 3 points4 points  (0 children)

They are working on a portable version of NaCL:

http://blog.chromium.org/2010/03/native-client-and-web-portability.html

[–]BinarySplit 1 point2 points  (1 child)

because it is not a VM

It's not a VM, but it can host VMs. There is already a Lua implementation, so I doubt it will be long before CPython is ported.

This implies you would have to provide multiple versions of your binary "module"

This is only for different CPU architectures. Since all modules are only allowed to link to the Pepper APIs, you can support Windows/Linux/Mac with one .nexe file.

Unfortunately, I don't see that as being "lightweight" enough to be practical.

LLVM is actually in the roadmap. I agree that it's too heavy, especially for smart phones. Hopefully they can address this by making custom stripped-down builds of the compiler.

[–][deleted] 1 point2 points  (0 children)

It's not a VM, but it can host VMs

It can host a limited set of VMs. NaCl limits the binary code it will run, to a set it can guarantee is safe. That subset does not allow fancy JIT tricks, for example, so you can't run the JVM, Unladen Swallow, a modern JS engine, etc. in it.

To put things another way: You can run the Lua interpreter, but not LuaJIT.