Haxe as a scripting language?

I’ve been playing with Haxe for a couple of days now, firstly because I wanted to find an alternative to using JS or Lua bindings plus C++, and also because Haxe could become my weapon of choice from now on.

I mean one could think that something like Haxe could come in handy with so many programming languages these days :wink:

So, Cocos2d-x already have support for one too many languages, C++ in the backend and two scripting languages, am I proposing a third scripting language? Not really, I just think that having the Haxe compiler at hand with the appropriate externs could do the job, so I just wanted to ask whether someone have already tried it, and what could be his/her thoughts on the matter.

Any comment is appreciated,
Regards.

To be honset it reminds me of this, if I can be somewhat facetious: https://xkcd.com/927/
Also to be complete there is hscript: https://github.com/HaxeFoundation/hscript

I do feel this is an example of solution looking for a problem, mostly, based on my limited experimentation and usage of Haxe and HaxeFixel.

If you want to use Haxe it makes more sense to me to use HaxeFixel or similar pre-existing haxe-focused engine or write a cocos2d port instead – essentially add scene graph and actions to HaxeFixel if not already supported, or use a Haxe OpenGL layer and port the node logic on top in Haxe lang.

If web development teams use TypeScript/CoffeeScript/SASS in their toolchain instead of pure Javascript then similarly Haxe is a viable option for someone writing a game where they need to run on Browser & Desktop & Mobile, but it often comes with more difficult debugging, requires extra build steps, and otherwise just adds cruft to a project. But if the benefits outweigh these disadvantages then by all means start writing a Haxe bridge to cocos2d-x yourself if you want to write Haxe.

I definitely don’t see Haxe->Cocos-JS to be a good solution, unless you love Haxe and hate JS.
I could see using Haxe like JSB where you write Haxe for all game code and it compiles and links to the cocos2d-x native library. But again it would mostly benefit only those who love Haxe over Javascript.

Haxe seems to be targeted more at those who desire write once and use with multiple languages. Web Client(Javascript)/Server(PHP) is a good example where this is beneficial, but even then it has to be tested against using NodeJS/TypeScript (or similar) instead.

All that said a C99 interface would likely be superior if cocos2d-x wanted to support more languages. It essentially is the “LLVM bytecode” without needing an LLVM interpreter.

My 2c :smiley: