News for hackers. Stuff that matters.
Re:Duktape: an embeddable JavaScript engine by bsilvereagle on Sunday March 23, 2014 @08:53PM (#7456026)
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?
Re:Duktape: an embeddable JavaScript engine by yetfeo on Sunday March 23, 2014 @10:38PM (#7456396)
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.
Re:Duktape: an embeddable JavaScript engine by anonymoushn on Monday March 24, 2014 @05:24AM (#7457329)
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 by hajile on Sunday March 23, 2014 @09:46PM (#7456224)
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 ideal, so I'm quite happy with the prospects of using it.

Re:Duktape: an embeddable JavaScript engine by eropple on Monday March 24, 2014 @02:51AM (#7457060)
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 by anonymoushn on Monday March 24, 2014 @05:36AM (#7457360)
If Lua's semantics are acceptable, you can make a loader that runs your Lisp in Lua. This is probably less effort than it sounds like. Moonscript is a decent example of a mostly expression-oriented language as a Lua loader, so it should be simple to make it read a Lisp instead.
Re:Duktape: an embeddable JavaScript engine by eropple on Monday March 24, 2014 @10:35AM (#7458410)
Interesting approach, thank you. I don't much care for Lua (either as a language or as an API, especially when dealing with C++), but this is a pretty neat concept to think about.
Re:Duktape: an embeddable JavaScript engine by PythonicAlpha on Sunday March 23, 2014 @09:35PM (#7456187)
The point is not, if a language is superior or has the better "OOP" quality. People tend to use what they know and JS is currently one of the "in" languages.

What is the benefit, if your scripting language is the price-winner from Harvard Business school or something else, but nobody knows it and wants to learn it. So many (good) languages have passed away, nearly unnoticed.

One of the big attractions of Java and JavaScript: The syntax. The C/C++ like syntax was and is just in fashion ... even when it is criticized by many. But everybody knows it and everybody (it seems) like it.

Re:Duktape: an embeddable JavaScript engine by rmrfrmrf on Sunday March 23, 2014 @09:23PM (#7456138)
Probably because Lua is horrible and JavaScript is awesome. Also npmjs.
Re:Duktape: an embeddable JavaScript engine by anonymoushn on Monday March 24, 2014 @05:26AM (#7457333)
After my initial fit of laughter, I am now curious which things JavaScript does better. Please enlighten me.