Why on earth should I focus on Haxe, rather than the native technologies?

I’ve heard about Haxe, yes. But I’ve been very confused about why I would ever want to use it instead of using native tools directly. I found this earlier post here for example:

I believe that by using native tools directly, such as the Android SDK and C++ APIs, I am given:

  • First class features, since I’m not dependent on a 3rd party implementing a wrapper for some native update or something.

  • My code is somewhat guaranteed to compile, even if something in the APIs would change.

Is there any more benefit to Haxe than faster time to market?

Hello,

welcome to the Haxe world. If you know how to use native tools, then you don’t need Haxe of course. But if you want for example to have dynamic behavior in your app, you want to have one source code targeting (trans-piling to other languages like Lua you mentioned), then Haxe can be your choice.

Remember, programming languages and tools associated are just that: tools you choose based on your preferences or your needs. Nothing more and nothing less.

1 Like

As for myself, I came to Haxe in 2010 having a strong Actionscript 3 background. I wanted a way to use my existing skills to take advantage of old platforms (Flash) with the option of using new platforms as needed in future. I’m a single developer with limited time, so I try to choose tools which prevent having to redo everything. If I need to use a new platform, I can learn what I need and the Haxe code only requires some modification rather than a complete rewrite which abandons other platforms.

Recently for one project I’ve made software that compiles to Javascript and runs in a browser. However I now have the need to run my code on a web server, so compiling to Hashlink seems to be the best way forward right now and I’m optimistic. Depending on my future requirements (and improved Haxe libraries) I still may have the option of switching to Node.js, Java, etc. Haxe makes that easier in my view.

1 Like

I should also mention that the language itself has advantages over some other languages. For example if you get into using macros you can do some very interesting things which exclude me from the conversation eventually. :slight_smile:

Welcome @mavavilj

I was ignorant of JavaScript and Haxe offered a way to generate js along with all the other languages. forGL project outputs C++, Python, Java, C# and JavaScript using a simple batch file and repeated use of Haxe to compile to different target languages. This is way cool compared to other approaches.

Having multiple implementation languages available lets someone decide to try out forGL using the Python or Java build for example because it is likely that Python and/or Java is already installed. So you only need to create a dir and copy a forGL dictionary and the program (.py or Java archive) to run.

Also there has been discussion about how Haxe provides a better js experience than TypeScript in some ways. I enjoy the type inference Haxe has and I also have the same approach in forGL.

Hey there :slight_smile: . Thanks for the question.

Haxe’s website title says it all: the CROSS-PLATFORM toolkit. Haxe is amazing for designing APIs that can target multiple platforms, NATIVELY. But as other posters said, it depends what you want to do. Personally, I use it for designing a platform which mostly consists of APIs and an intricate object ecosystem.

It depends what you mean by “native”. While Haxe doesn’t call native Android, iOS libraries, you CAN generate C++ / Java code that RUNS NATIVELY. That’s precisely MY use case. I code in Haxe because my project is a library. I intend to deploy this library natively across platforms, and then the developers on those platforms can use my library natively, using whatever language works best on their platform, be it C++, Java or JS. Want to run this on a cheap server? Want to use it natively? Transpile to C++. You get the same functions to call and the same inner workings with minimal adaptation effort.

My long-term plan is to foster an ecosystem of Haxe Hax0rs (pun intended) that will help out, especially in areas where I haven’t delved in, such as Haxe’s macros, which are absolute awesomeness.

But that’s just my use case. Oh, also, I LOVE underdogs :smiley: . I’ve always been attracted to smaller communities. The response rate & dedicated help I found on these forums alone is mind-blowing. With 0.0…n…1% of the user base of Stack Overflow, I got here help with a MUCH more friendly attitude (or, should I say, with no attitude :wink: ). It’s like we’re building our own small little village, and it sure feels better than the troll-infested megalomaniacal self-righteous ghettos on other websites. Man I’m so gonna get trolled for this comment one day :smiley: :smiley: :smiley:

Then there is Shiro Games, who has a vast portfolio of games built using Haxe.

2 Likes

I was toying with this idea in the Discord chat lately:

-A GIS application that has to interface with C++ numerical libraries and some Google Maps kind of thing, which is in Java or JS.

Is this a proper use case for Haxe, and is it better than the alternatives? The common tool for this is now node-ffi. There are also jobs for node-ffi.

But I’ve also been led to believe that Haxe is potentially far superior technology than most things having to do with JS.