160 points · by yawn · 8y ago · 88 comments
Five years on from starting with Haxe at FontStruct, I’m genuinely surprised to find that I feel no regret whatsoever regarding our decision to go with the technology.
I absolutely adore the language. Not only is it awesome at transpiling/compiling to native across this whole spectrum of targets, the language itself keeps surprising me with how versatile it is; with great type inferencing, compile time macros, platform-conditional compilation, and more.I've launched iOS, Android, Web, Windows and Mac apps that all shared the same code base. I can't see myself ever wanting to go back to using a single-target language again. I highly recommend trying it if you're on the fence. [0]
Note: I am not affiliated with Haxe, just a huge fan.
... shudders
Conditional compilation is a horrible, horrible idea period, and is particularly easy to turn into an indecipherable brittle mess in haxe. This was made worse by the previous authors of the code we inherited, but is really a case where it’s the tool’s (haxe’s) fault for implementing the feature in a way that makes it an intrinsic foot gun.
Lastly, it was a big turn off to our candidates, and many people we interviewed expressed lack of interest in working with it.
Some libraries that work on top of Haxe can give you a standard API that’ll let you not have to conditional compile (OpenFL, NME), but in general there’s a lot of trade offs that need to be considered at a platform level for drawing that conditional paths for drawing aren’t too uncommon.
For his new game, Return of the Obra Dinn, he went with Unity because of its 3D capability:
https://forums.tigsource.com/index.php?topic=40832.0
> I'm gonna use Unity for this one. I fell in love with Haxe/OpenFL on my last project but unfortunately the 3D situation is not that great there yet. Also, it's time to finally see why 90% of the indie scene is using Unity. I have a good amount of experience with 3D games and the few days I've played around with Unity so far have been pretty productive. The animated title screen scene up there (with post-processing shaders and all) was created in one day. I now have unrealistically high hopes.
In my current project I ultimately switched off of Unity for 3D due to its less than stellar WebGL support (and I wanted to target web), but with Haxe I simply changed my target to JS and got to reuse most of my code. The ability to switch/add targets at any point of your product’s lifecycle is incredible.
It's nice to see a project with such a dedicated community.
It's a shame that most developers started using TypeScript instead of Haxe; that seems like a missed opportunity. TypeScript was pretty painful to use in its early days; it shows the importance of positioning and marketing.
-- My love list --
- The generated JavaScript is usually faster and smaller after compile-time optimizations, for example, objects can be inlined so they become stack-only and don't hit the GC. Example: https://try.haxe.org/#0F337
- It's expressive (but familiar); nearly everything is an expression and switch statements support pattern matching:
var animal = { species: "cat", breed: "bengal", age: 15 };
var friendliness = switch animal {
case { species: "cat", breed: "russian-blue" }: 100;
case { species: "cat", breed: _, age: age } if (age < 5): 300;
case { species: "dog", breed: "golden-retriever" }: 1000;
default: -1;
}
- Fast compile times (for sizable projects you get hundreds of milliseconds rather than seconds – and faster still with incremental builds enabled)- No need for separate tools like webpack:
> You can perform arbitrary compile-time behavior (like processing and embed assets or generating code) by marking haxe code as a macro
> Generates a single bundle by default
> Dead code elimination built-in
-- The downsides --
- Not many people know about it so it's usually better to stick with TypeScript with clients
- The smaller community means if you might have to be more hands-on, both in learning haxe and when it comes to working with haxe libraries – i.e. fixing a bug upstream rather than waiting for the community to fix it
- The package manager is more bare-bones than npm (personally I _much_ prefer this – I find `npm` and `node_modules` can be a nightmare to work with) but there's a general ask in the community for more advanced package management
If corporate support is a definite factor, Dart would have taken off way earlier than now. A bigger factor in TypeScript's success would be the ability to gradually migrate the projects as it's a superset of JavaScript. How do you start migrating? Flip the file extensions from .js to .ts with loose compiler options, then gradually add typing as the options are tightened. It's factors like these that drive spread of language, not "huge corporation with infinite budget and a large full time team of contributors and evangelists." Dart had no short of those and still not much accepted.
From an external perspective, Google's enthusiasm for Dart seemed half-hearted at best. Its launch was encumbered by rocky political issues, with half the community terrified that they were looking at a new VBScript, and Google's competitors actively stoking said terrors. It could've jeopardized Chrome's ascendance by turning off tech people, on whom any new software depends for propagation, and giving MS/Apple/Mozilla some room to doubt Google's commitment to the extant web, and that was surely enough to make pouring heavy resources into it a non-starter from a business perspective. It's naive to believe that any technical considerations entered into it.
Take a look at Kubernetes if you want to see what happens when Google is committed to using that G-Juice to cram something down the community's throat.
If Chrome team actually cared about Dart and went ahead with Dartium's integration, Dart's future would have been much different.
Then the Angular team decided to dump Dart and go with Typescript.
So politics as usual.
There are other languages pushed by a big corporation that fail so having the big corporation is a necessary but not sufficient condition.
See the discussions of soundness versus usability in typescript where they took a lot of heat from some people, but I believe absolutely have made the correct compromises.
Disclaimer: have never used Typescript.
It's not a surprise at all that the likes of Microsoft and Google and Mozilla are able to promote and push new languages to significant widespread adoption.
*Not so obscure anymore; Motion-Twin is well known for the hit game Dead Cells, and their former employee, Nicolas Cannasse, who is credited with inventing Haxe, went on to found his own studio with its own successful games (Northgard especially)
So like Lisp, Scheme, Haskell, ML and so on?
[0] https://github.com/vshaxe/eval-debugger
[1] https://haxe.org/manual/debugging-source-map-javascript.html
[0] https://haxe.org/manual/target-javascript-injection.html
[1] https://haxe.org/manual/target-javascript-external-libraries...
I also like purescript - which I like to think of as 'typescript, where the types have teeth' (I like that I can also pull in a js lib and use it)
Haxe seems to be much more conservative in development. Haze is aquiring arrow functions but I think there was quite a degree of initial resistance to the notion. I proposed a change to allow the new Javascript style consice object literals (simply allowing {fish,cheese} instead of {fish:fish,cheese:cheese} but was shut down with a 'we don't like it'
I would prefer to use a independent language over one developed by a megacorp, but I fear Haxe will fall behind TypeScript due to their resistance to change.
My own personal experience has motivate me to move to something else. The proposal I mentioned above left somewhat of a bad taste. The process went contrary to the processes listed. Notably The proposer is supposed to call a vote after discussion had concluded. Instead it was just shut down with a "we had a meeting and decided against it". I could give no counterargument because there was no argument to counter. I'm not against languages having a dictatorial model for development, but having a facade of an open process that carries no weight seems wrong.
Change proposals are subjective, so people can have different opinions on whether a change should be accepted or whether it was well-formulated enough. What bugs me though is that the Haxe team has a documented process for considering and voting on these proposals, which they don't follow. If Nicolas doesn't like a feature, it's essentially vetoed. If he changes his mind later, it'll be implemented without any further discussion. Most discussion happens in an internal Slack channel so there's no transparency. It's essentially a BDFL masquerading as a democracy, and it can be frustrating to try to contribute as an outsider if you don't realize that. See inline XML for example (https://github.com/HaxeFoundation/haxe-evolution/pull/26) - a lot of discussion, open questions remaining, seemed like Nicolas was generally resistant. Then suddenly, there's a PR and it's merged, and it will be in the next version of Haxe.
IMO, this is not the way to run an open source project. And in my experience, the team is resistant to feedback and takes things personally, so I've lost confidence that it will change.
I don't think that you get a good language by having design by committee. I'm all for democratic process and contributions in many different areas, but you simply can't apply that to language design, but you really need a way to understand and see the big picture, and not only reason about a particular local feature.
The only thing we could do better here would be to spend more time motivating my decisions so they seem less random to people from outside, but it's time consuming to do so and I'm sadly lacking the time for it.
I understand how this can be badly perceived but you shouldn't put ill intend behind what has happened to your proposals.
Also, I saw you started designing your own language, which is very different from Haxe from what I have seen, so it seems to me what you wanted Haxe to be was simply not what it is and will be.
If you don't feel design decisions can be made effectively by a committee and prefer to steer these decisions yourself, that's understandable - just remove the language about the core team voting on proposals or reaching consensus, because in practice it's not how the process actually works.
As for the process, I think it has become a little more stringent for sure. To submit a request for consideration you’d need to submit a proposal on GitHub with attention paid to impact to existing code and impact on future Haxe features- perhaps your feature request wasn’t deemed to be thought out enough? It also looks like you’d get more explicit consideration if you are a sponsor of the language (https://haxe.org/foundation/support-plans.html)
So yes, while it isn’t a completely open vote, I also think most languages’ directions are decided by committee in a similar way. I’m sure the Haxe community would love to see examples of other communities with better practices to learn from.
Why the automatic defense of the Haxe team? Frankly, small communities like this sometimes come across as cult-like in their response to criticism, and it isn't a good look.
Here's the proposal in question: https://github.com/HaxeFoundation/haxe-evolution/pull/51
Here's the process which wasn't followed: https://github.com/HaxeFoundation/haxe-evolution. Very little discussion, no public vote, even though the proposer put in the effort and clearly wanted to engage.
When someone puts in the effort to make a proposal like this, this bait and switch is not a way to keep them around, and insulting them in HN comments isn't any better.
In which case surely it should be discussed, rather than shut down with "no"?
This thread had me interested in Haxe, but reading these comments about the unfriendly, negative responses to proposals has put me right off.
A little discussion about the proposal. Some didn't seem to like it because of 'language clarity'. Some group of core developers discussed it and rejected it.
I don't know what one expects but I have seen quite some language proposals (rejected) and this didn't seem inappropriate to me. They don't want it.. accept it or move on. They gave a reason. If you think it's sufficient is another thing and mostly about opinion.
That said, you can always file an issue in github and have a discussion there. For Haxe it’s a very active location for discussion there.
Basically what I'm saying is that for Haxe to be truly crossplatform, it requires Haxe-native frameworks in the target domain. But that doesn't really seem to be the case outside of games, so that advantage is lost.
I really like the language (after reading the tutorial at least), but I'm not sure where would using it make sense. For backend stuff it just seems completely inferior to Typescript (considering library support especially).
Flash (a browser plugin) being dead does not make ActionScript (a programming language) dead
you can use ActionScript to publish with Adobe AIR and Haxe AFAIK can do that too
Then explore the code cookbook for more advance usage and patterns https://code.haxe.org/