First of all sorry for my English, it's not very good.
I am currently implementing an interactive 3d engine, and I want to add a script engine. After a hard search on the net, I decide to go with javascript (there exist several opensource engines like Google V8, spidermonkey...)
I also check ECMAscript versions and I see that v4 adds Classes, interfices, ... and some interesting features that I want, the problem is that v4 will never be implemented.
I aslo check that Unity uses this features but it seams that they implemented it.
I do some test with Chrome (because I'm interested in V8) but when I do something like:
class Foo
{
function test() {...}
}
It throws an error. "Unexpected reserved word". The same hapens with Firefox (spidermonkey).
My question is: Is there some javascript engine that implements this features (classes, static typed, interfices, inheritance, ...) to be embeded on a c++ aplication?
It has to had non comercial licence and writen in c or c++, and ofcorse fast...
ECMAScript v5 seems that didn't specificate this kind of things.
Maybe with Mono?
Thanks a lot.
Javascript as script engine with classes, interfaces, … its possible?
JavaScript doesn't have 'classes' in the C++ sense of the word. You can emulate some of the features of C++ classes using constructor functions and prototype inheritance, but you will never achieve a 1-to-1 mapping of functionality - the concepts behind the two object systems operate in fundamentally different directions.
Perhaps you should be looking at a scripting language that is more oriented towards C++ concepts (for example, AngelScript is a decent choice)?
Perhaps you should be looking at a scripting language that is more oriented towards C++ concepts (for example, AngelScript is a decent choice)?
Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement