41 comments

[ 2.6 ms ] story [ 79.7 ms ] thread
It might be time to try Haxe. I’ve always wondered why it doesn’t get a lot of buzz around it. It seems like a genuinely good way to achieve “write once, run anywhere.”

It’s always interesting how the chicken-and-egg problem applies to programming languages.

Its a nice language though some of the output is weird. Like I did a PHP target as a test and I think I did a print statement and it added a lot of code in there when i was expecting a simple echo or something. So it can have its downsides depending on what you do. Definitely curious where it stands for Mobile though.
It's great for mobile games - it has a nice foundational library, OpenFL, and an assortment of wd game engines.
I wonder, did you have the "dead code elimination" feature enabled? (Just throwing it out there. I haven't tried transpiling to PHP with it myself. :) )
Not sure, this was many years back but if it wasn't a default it's very likely I didn't.
Languages without a big tech company behind do not get popular, all the popular new languages ahve big companies behind Rust,Go,TypeScript
Single-big company control/backing is not sufficient (Dart) nor historically necessary (Python, Perl, Scala, Ruby, PHP, Lua, JS).

I'd agree though that it's a huge marketing win.

The biggest thing that interests me about Haxe is it is rare to find a high-level language with a sophisticated static type system and familiar syntax. This is why TypeScript is so much beloved, but Haxe has some awesome features TypeScript lacks, like a pattern-matching switch statement (with guards), and array comprehensions.
And don't forget the macro preprocessor, it's made life a lot easier for me in so many ways. Syntax sugar, automatic asset inclusion, compiling tasks, and much more.
I couldn't agree with you more. The pattern-matching in Haxe has really helped keep my code more readable.
Written by a long-time OCaml developer, so not too surprising.
Is haxe used for anything other than games? The userbase seems to have a focus on flash, games etc.
I’ve used it for web (my failed startup was in Haxe, my side projects still are mostly Haxe).

To be honest these days I mostly just use it as a “better JavaScript” because I’d prefer my backend to be NodeJS rather than PHP or Java or sone other Haxe target. But I really do prefer it to JavaScript, even with Babel and Flow and ES6 and all the things to modernise Js.

Curious— have you ever tried compiling to C++ or CS for the backend?
Same here. It's a "better Javascript" for me as well. My constraints force me to use JS for what I'm building, and Haxe does a great job of insulating me from having to write and maintain a large codebase in JS.
For sure--see the examples of FontStruct, TiVo, DAZN, Heidi, etc. in the article, along with the part just before the quick start section. :) (It's true, it does have a large gamedev following, but it's actually quite versatile.)
There are some people used it quite extensively for web development (both front and back-end). This year's Hong Kong Open Source Conference will feature two Haxe talks, both are web focused:

* https://hkoscon.org/2018/topic/haxe-better-javascript-practi...

* https://hkoscon.org/2018/topic/type-safe-rest-api-haxe

I believe there will be live streams, or you can checkout the video that will be available shortly after.

(I'm a member of the Haxe Foundation, also the organizer of the HKOSCon Haxe track)

I've mostly used it for web (mainly react applications recently), for several companies.

The haxe->js community is growing these past years, but I still think Haxe isn't getting the love it deserves (compared to TypeScript, Flow typing for react, etc.)

Even if that is the case, I would argue it is already a success story, it doesn't need to be good at everything.
Sure it is. Haxe is a good alternative to javascript, and is appreciated for it's isomorphic capabilities
We used Haxe for a while at my last company for a cross-platform engine that would actually run well on web (browsers couldn't yet handle "real" Unity WebGL builds at that time).

While it "worked" and the resulting engine / suite of games ended up net profitable, and I'm a fan of Haxe's features as a language (I am really missing the pattern matching and macros in Typescript these days), I must say the build pipeline and available tools for OpenFL / Haxe games was lacking at best.

On the plus side being able to fork and fix issues we ran into was a game changer over Unity IMO.

Not sure if the ecosystem has evolved / improved on the build and tooling fronts in the last 18 months since I last interacted with it directly, but that would be the one word of caution I'd offer to anyone after they read this article. Be prepared to roll up your sleeves and get a little dirtier than usual if you really intend to ship on both web and mobile.

Not sure of the specifics in the last 18 months on straight OpenFL, but I know that some frameworks built on top of it had nice features like hot reloading. HaxeFlixel has an in-game debugger, too, for example. I guess it depends on the types of tooling you had in mind.
OpenFL's matured a bit since then and I quite like it personally, though I should point out that OpenFL is simply one of many libraries, and the rest are worth checking out, too! OpenFL's probably the most well known but the ecosystem has a lot to offer beyond that.
> I must say the build pipeline and available tools for OpenFL / Haxe games was lacking at best

That was my experience as well.

Too many moving pieces going in different directions. When it wasn't a Lime issue, it was Hxcpp, or OpenFL, or a combination of these. That was 3-4 years ago though.

I used Haxe and NME years ago to build an Ouya (RIP) game. I was coming from actionscript and it was a delightful language. Glad to see it's still evolving. That game project was a blur of haxe, java, and c++ due to Ouya's infancy and haxe could handle it all. I was impressed
I've been using Haxe over a decade, and it's really a shame it doesn't get more attention. The language is amazingly productive for game development, although lacking the GUI tools of Unity.
Like I did a few years ago, I quickly browsed through some of the sites and didn't find solid quick start stuff needed to get me (a haxe noob) to go further.

For a 'mature' platform looking to get more attention I would have liked an easy step-by-step demo 'hello world' for a haxe -> android target.

But, I couldn't even find much in the way of haxe-for-dummies that specifically address the android target.

Oh, but, if you have wine or some virtualization software you can run quickly get started using 'haxedevelop'...

I guess it's not that multi-platform, after all.

Sure, or vscode, vim, IntelliJ, sublime. There are a ton of options.
That's a bit like saying that C++ isn't multi-platform because Visual Studio is Windows-only.
Haxe doesn't quite operate at that level, it's more compiler than build tool. You'd use Haxe to compile to Java or C++, but you'd use a framework such as OpenFL, which provides its own build toolchain, to actually build an Android app via Haxe.
I've deployed a HaxeFlixel project to Android, a couple years ago. I'll be sure to consider this angle for a follow-up piece. Thanks! :)
Amanita Design should have used Haxe instead of dead Adobe Air for their games.
The language is awesome, heavily inspired by EcmaScript4 / ActionScript3.
Been using Haxe for a webgame project and thus far have been blown away by the functionality and features available as well as the community.
I'd like to chime in and add that I've had to rebuild an entire Visual Programming Language (think Scratch, but free of text) to migrate away from Flash. I picked Haxe, and it has been a solid language+compiler for what I needed (transpile to JS, and now my code runs on any modern browser).
Popular Ludum Dare contestant 01010111 has made some slick 48-hour games in Haxe.[1] Even winning the compo once too.

From what I've seen Haxe has a lot of great features for individual game developers to be expressive.

[1] http://ludumdare.com/compo/author/01010111/

I used Haxe years ago to make Flash games and tech demos [1] (probably only works with Chrome these days). At the time it was the only free way to create Flash games (at least using an actual programming language) but even when Adobe released some free tools, Haxe was still not only much faster as a compiler but it both produced faster code and provided tools for making things fast (e.g. `inline` wasn't just a hint, if the compiler couldn't inline a function it would error out - and inlining made a difference at the time).

Eventually i lost interest in Flash and moved on to other things. I thought about using Haxe for making HTML5 games (when those were new), but unlike Flash gaming that was huge, HTML5 gaming never took off and was almost entirely about mobile games that i never cared much about. Also Haxe's JavaScript output at the time had some significant overhead that i found it simpler to just write JS directly.

I've been subscribed to the Haxe mailing list for the last 10 or so years, mainly to take a peek at what is going on and sometimes try a new version (sadly it seems Haxe is sometimes breaking backwards compatibility and often found the code needing changes), but that ended recently with the mailing list shutting down. Since then i had no other contact with the language at all.

Although sometimes i see people writing "one-to-many" transpilers, thinking that this is a neat new idea, while i'm in my corner muttering something along the lines "Haxe did that a decade ago" :-P.

[1] http://runtimeterror.com/tech/demo/flashdemos.html