20 ms·
The Joy of Haxe
- jondubois 8y agoHaxe is strange in that it seems to be very well known among developers but relatively very few actually use it. I guess it's an old project with very specific use cases; like building certain kinds of multi-platform apps. 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.
- sdegutis 8y agoWell TypeScript also had a huge corporation with infinite budget and a large full time team of contributors and evangelists which probably helped adoption.
- simion314 8y agoExactly, many of the new trendy languages have a corporation behind that can with money and by association get the language known.
- larsiusprime 8y agoExactly this; frankly, I think it's amazing that Haxe is as relatively well known as it is given it's humble origins at a once obscure* French game development studio. 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)
- m_sahaf 8y agoCounter-example: Dart. 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.
- redisman 8y agoHas Dart taken off? I think most people recoiled in horror when they saw the early-days "hello world" turn into millions of lines of generated code.
- Kaveren 8y agoNot that I'm aware of, no. I don't know, but it seems to me like WebAssembly is more promising for conveniently bringing all programming languages to web applications, rather than languages like Elm or Dart whose standard implementations compile to JavaScript and are designed only to program web applications.
- pjmlp 8y agoOnly inside Google on the Ad Words team that kind of rescued Dart after the Chrome team stop caring about Dartium. Now the Flutter project is Dart's last hope to keep it relevant outside Google. It remains to be seen how serious Google is about Flutter, as the Android team only gives political correct answers when inquired about Flutter vs Android.
- haxiomic 8y agoI've been using TypeScript professionally for over 2 years now and compared to writing JavaScript it's indispensable but for all my personal work I prefer haxe -- 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 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
- segmondy 8y agoI really disliked Javascript and swore of it no matter how much it took over the world till typescript. If typescript is not enough, I'll use another language go/python and use web assembly to generate js. js is a byte code to me. However, the advantage of typescript is that I can pull in a js lib and use it.
- haxiomic 8y agoSame with haxe, you can use an untyped js lib with the `untyped` keyword [0] or use an extern to enable strict typing[1] (like TypeScript's d.ts) [0] https://haxe.org/manual/target-javascript-injection.html https://haxe.org/manual/target-javascript-injection.html [1] https://haxe.org/manual/target-javascript-external-libraries.html https://haxe.org/manual/target-javascript-external-libraries...
- platz 8y agoI like typescript. 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)
- coldtea 8y ago>Haxe is strange in that it seems to be very well known among developers but relatively very few actually use it. So like Lisp, Scheme, Haskell, ML and so on?
- platz 8y agoThe first law of programming language intersectionality is that the interesting things will always be happening in languages other than the one you actually use.
- jplayer01 8y agoI'd say one of the issues with Haxe was always tooling. I don't know how it is now, but when I was looking at it a few years ago, debugging it wasn't really possible.
- haxiomic 8y agoThese days you can use the debugger in VSCode[0] with the eval target (which is used to execute haxe directly). When writing platform specific code you can use the platform's debuggers, for example, you can use sourcemaps to debug the JS target [1] [0] https://github.com/vshaxe/eval-debugger https://github.com/vshaxe/eval-debugger [1] https://haxe.org/manual/debugging-source-map-javascript.html https://haxe.org/manual/debugging-source-map-javascript.html
- danso 8y agoI first learned about Haxe through Lucas Pope’s dev log for “Papers, Please”. Sounded interesting and fun, though Pope (who developed PP on a Mac) said he also had written custom tooling for his work — maybe that situation had changed since 2014: https://www.gamasutra.com/view/news/209905/Road_to_the_IGF_Lucas_Popes_Papers_Please.php https://www.gamasutra.com/view/news/209905/Road_to_the_IGF_L... 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 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.
- dyarosla 8y agoI wouldn’t be surprised if he does a mix of Haxe and Unity; Haxe compiles to C# too and works very nicely with Unity. 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.
- modernerd 8y agoMartin Jonasson also switched to Unity from Haxe for his latest game (Holedown), in part due to broader libraries being available and more actively maintained, and a bigger dev community. http://grapefrukt.com/ http://grapefrukt.com/
- dyarosla 8y agoLike the author, I too have the same opinion after having used Haxe for over 5 years. 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. [0] https://try.haxe.org/ https://try.haxe.org/
- mlthoughts2018 8y agoI’ve only had the opposite experience. I worked on a team that inherited a large Haxe codebase for an online education tool, and we found Haxe to be exceedingly bad, even apart fron the nature of the code we inherited. We spent a lot of time porting most of it to a mix of Scala and Javascript. I still remember the daily emotional stress of working in Haxe. ... shudders
- dyarosla 8y agoWhat was bad specifically? This comment reads more of a ‘the codebase we inherited sucked to rewrite’ than anything else.
- mlthoughts2018 8y agoSome things are generic critiques of haxe: standard library has poor documentation and big feature gaps, often important third party tools are basically abandoned, no support, generated code is extremely hard to debug or understand (both C++ and Javascript outputs for us). 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.
- roywiggins 8y agoI am glad Haxe is still going strong. I remember when it was an alternate language for the Flash virtual machine- everyone thought it was very cool at the time. Now Flash is dead, long live Haxe!
- zwetan 8y agoyou're comparing apples and oranges 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
- titanix2 8y agoNo he's right. Haxe was developed by a French game company to target the Flash runtime instead of using Adobe's compiler. It can also compile to other languages: it was uses to code the full stack in the same language will using popular runtimes at the time (PHP, Javascript, Flash).
- pjmlp 8y agoFlash might be dead for HN Flash haters crowd, for everyone else it lives on as Animate. https://www.adobe.com/products/animate.html https://www.adobe.com/products/animate.html
- chc4 8y agoI was talking with some friends a bit ago and was surprised to learn that Haxe is used a lot in game dev and embedded a lot. Apparently a lot of set top boxes like Tivo or car infotainment systems use it, and there's a lot of very good game engine infrastructure in it - https://armory3d.org/ https://armory3d.org/ was specifically mentioned as being surprisingly high quality, and all the people that wrote games on Kongregate apparently switched to Haxe.
- Lerc 8y agoI used haxe a lot in the past, but with the newer enhancements to JavaScript I found that I ended up using JavaScript. Destructuring assignment arrow functions and more concise object literals, ... operator enable much more concise and readable code. 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.
- dyarosla 8y agoSucks to hear about your experience. Like you said yes arrow functions are slated for the next major release. 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 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.
- GordonS 8y ago> perhaps your feature request wasn’t deemed to be thought out enough? 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.
- jimhefferon 8y agoBest way to learn it?
- haxiomic 8y agoThe manual on haxe.org is a good place to start https://haxe.org/manual/introduction-what-is-haxe.html https://haxe.org/manual/introduction-what-is-haxe.html Then explore the code cookbook for more advance usage and patterns https://code.haxe.org/ https://code.haxe.org/
- giancarlostoro 8y agoI want to love Haxe but tooling outside of Windows seems limited, although I havent looked at how good VS Code is with it yet, so maybe I'll look into that. Otherwise I am going to stick to D and Python.
- elsassph 8y agoHaxe support VS Code is actively supported by the Haxe Foundation and has become pretty amazing TBH - and I'm a HaxeDevelop fan.
- haxiomic 8y agoIt's gotten better in the last year; VSCode seems to have become the main IDE in the community and the vshaxe plugin is used to drive new haxe autocomplete features in the compiler
- k_ 8y agoI never used Haxe in windows. I agree that ten years ago tooling wasn't all that great (on linux at least), but now with the focus on VS Code we have a language server following Microsoft's LSP [0] that we can even use on other editors (sublime text, neovim, etc.). [0]: https://langserver.org/ https://langserver.org/
- giancarlostoro 8y agoGood to know, and yeah, at least someone knows what I meant.
- damoebius 8y agoIntelliJ plugin is also pretty amazing.
- mromnia 8y agoIs it possible to use Haxe for anything except gamedev and keep the crossplatform aspect? For example for backend webdev, it seems like you can compile to nodeJS and use express, but then you can't really compile to any other platform. You can compile to PHP, but you're also stuck with PHP frameworks. 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.
- ofrzeta 8y agoDoes it realistically make sense to have a web meta-framework that compiles to different backend frameworks such as Node.js or PHP?
- mromnia 8y agoMaybe, maybe not. It just feels to me like Haxe only really makes sense for gamedev, and even then only barely, because of huge, crossplatform game engines like Unity. 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).