Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SpiderMonkey vs JavaScriptCore vs?

I have a C++ desktop application (written in wxWidgets) and I want to add support for some scripting language.

Scripting would mostly be used for run-time conversions of strings, numbers and dates by user supplied JavaScript code.

I'd like to use JavaScript because it is widely used and everyone is familiar with the syntax.

Googling around, it seems I have two options:

  • SpiderMonkey from Mozilla
  • JavaScriptCore from WebKit

Has anyone tried those? Which one would be easier to set up? Do you know of some other implementation that is better for my needs?

BTW, I target Windows and Linux platforms.

like image 577
Milan Babuškov Avatar asked May 21 '09 22:05

Milan Babuškov


2 Answers

There is also Google's V8 JavaScript engine, builds nicely on Linux, embedding API seems quite straightforward too: (Compared to SpiderMonkey's, never looked at the JavaScriptCore API) http://code.google.com/apis/v8/get_started.html

like image 125
nextdayflight Avatar answered Sep 20 '22 00:09

nextdayflight


Of course, you could also use Lua, which not only is designed specifically for this, it's vastly faster than any JS.

Also, it's has well-designed semantics, a very minimal core, simple C API, great portability, a very mature JIT, the most helpful online community I've seen, etc...

like image 34
Javier Avatar answered Sep 18 '22 00:09

Javier