Live data from Hacker News

Duktape: an embeddable JavaScript engine

duktape.org

21–30 of 44 posts

Re: Duktape: an embeddable JavaScript engine

#21
post #7
post #6

This looks really cool. I always wanted a small embeddable JS engine with a C interface. And it looks like you modelled the C API after the Lua C API? That is what I wanted as well. Here are some related projects I saved links to. I think there were a few others. http://code.google.com/p/tiny-js/ http://adaptive-enterprises.com/~d/software/see/ http://sourceforge.net/projects/njs/ v8 is an obvious open source impleme…

JavaScriptCore (the engine from WebKit) also has a very simple C interface (and I've seen it embedded by people as a static library without serious difficulty).

It's LGPL though, which is too restrictive for some projects (especially as a static library).

Re: Duktape: an embeddable JavaScript engine

#22
post #21
post #7

Earlier quoted context omitted.

JavaScriptCore (the engine from WebKit) also has a very simple C interface (and I've seen it embedded by people as a static library without serious difficulty).

It's LGPL though, which is too restrictive for some projects (especially as a static library).

FWIW, the only times I've seen it as a static library (and the only real place you need a static library) is on iOS (where it was actually extra-dubious and I'm surprised more people didn't point out the problems; specifically this was as part of one of those JavaScript app frameworks like Titanium, although I don't quite remember if it was specifically Titanium), and JavaScriptCore is now provided on the system by Apple as a public framework as of iOS 7. On any other platform you should have no trouble shipping it as a dynamically-linked library due to its simple C API.

Re: Duktape: an embeddable JavaScript engine

#23
post #9

Why does the readme say "liberal license" when the license file is in fact "MIT license" Why hide the fact that it is under the MIT license? Why is there a folder called licenses and why does it contain an unfilled in license (Copyright (c) )?

MIT is considered by most to be a "liberal license", and phrasing it that way makes for better marketing than stating the exact type of license in a "Features" section.

The additional license is for another project (murmurhash2).

Re: Duktape: an embeddable JavaScript engine

#24
post #13

If this is embedded in C++ I feel like you would be manipulating objects in the JavaScript scripts. JavaScript has OOP bolted on and it is not nearly as nice as Lua or similar alternatives. Why would a developer embed a JavaScript engine compared to something already existing?

Qt already uses JS in the form of QtQuick with quite a bit of success. JS using a prototypal system means that it can emulate almost any other OOP trivially (while the reverse is much harder). I prefer embedding lisp, but I realize that most developers don't know that language family (which mostly defeats the point of an embedded scripting language). JS seems to be the closest widely-known languages have come to this…

Do you happen to know an embeddable Lisp that can easily bind to C++ objects (rather like AngelScript or luabind)? I too would mostly rather a Lisp, but doing all the plumbing sucks.

Re: Duktape: an embeddable JavaScript engine

#29
post #16

If this is embedded in C++ I feel like you would be manipulating objects in the JavaScript scripts. JavaScript has OOP bolted on and it is not nearly as nice as Lua or similar alternatives. Why would a developer embed a JavaScript engine compared to something already existing?

I wouldn't describe JavaScript's OOP as bolted on. It's just a different kind of OOP - prototype based rather than class based. You could argue that Lua is more "bolted on OOP" since there are quite a few different libraries that build OOP for it.

That would be a silly argument. Lua's metatables are strictly more expressive than js's prototypes, and few libraries assume the presence of any sort of OO.

Re: Duktape: an embeddable JavaScript engine

#30
post #8

If this is embedded in C++ I feel like you would be manipulating objects in the JavaScript scripts. JavaScript has OOP bolted on and it is not nearly as nice as Lua or similar alternatives. Why would a developer embed a JavaScript engine compared to something already existing?

Probably because Lua is horrible and JavaScript is awesome. Also npmjs.

After my initial fit of laughter, I am now curious which things JavaScript does better. Please enlighten me.
Post reply on HN