Hacker News new | ask | show | jobs
by _ea1k 1955 days ago
I remember thinking that this was a MUCH better language than AS3 for Flash & Flex development. Now, 10 years later, I'm honestly surprised that it still exists and is being maintained.

I'm curious how popular it is at this point? Is there a big benefit over something like Typescript now?

6 comments

The benefit is that the Haxe compiler can target many more languages than any Typescript compiler. I've never used it, but I've seen some presentations and AFAICT its features and relative maturity (particularly of the overall project and community; i.e. its brain trust) make it a useful piece of technology for some companies making real products. Version compatibility is spotty, but that seems to be because Haxe features and targets are largely demand-driven by whatever product someone is currently trying to design and ship.
For desktop game development it seems better. I don't know if you can use Typescript for GUI applications without Electron or something equivalent. There are some successful modern games that were developed using haxe[0].

[0] https://haxe.org/use-cases/games/

There are Electron applications written in Haxe too (via the JS target and Node + Electron type definitions), such as these two level editors for games:

- LDtk: https://ldtk.io/

- Ogmo 3: https://ogmo-editor-3.github.io/

I have not used Haxe, but looked over at it while writing Typescript - one thing I noticed were macros, which could make writing high-performance Typescript/javascript much more bearable. For example iterator protocols in JavaScript almost necessarily allocate memory (especially for user-defined types), but manually writing a for loop does not (but is a bunch of copypasta for a complex data structure).
Haxe macros are very powerful, but not needed for that particular issue - the compiler supports inlining of methods and even constructors (which is useful for iterators in particular): https://haxe.org/manual/lf-inline-constructor.html
Funny, you're the second person in this thread to say something like this: 'Great language. Surprised it still exists!'
Sadly, technical greatness alone doesn’t make a good indicator for lifespan or widespread adoption. And maintaining a relevant evolution path of a programming language alive, with all the compiler tool chain, is a really huge challenge.
TypeScript makes a number of compromises to achieve optimal JS compatibility. Haxe doesn't have this goal since JS is just one of its many targets, and this shows in a number of design decisions (everything-is-an-expression, ADTs and pattern matching, etc).
Multiple compiler backends.