Haxe as a better JavaScript

As some noticed already, going from a proof-of-concept to a real app may be difficult: you need to maintain the integrity of your codebase as it becomes more complex.

One approach is TypeScript (look for the Visual Studio Code integration project on Github), another presented here is Haxe.

Haxe is a powerful strongly-typed language, yet with an unsurprising syntax, allowing you to prevent most errors at compile time. It has a very advanced support of the Observable API.

WIP integration and sample app: https://github.com/elsassph/fusetools-haxe

import Fuse.observable;
class View {
    var who = observable('World'); // Observable<String>
    public var hello:Observable<String>;
public function new() {
    hello = observable(function() {
        return &#39;Hello ${who.value}&#39;;
    });
    who.value = 42; // Compiler error: Int should be String
}

}

It might be useful to check even if you’re not using Haxe as it discusses problems like:

  • using an external JS file containing your code,
  • problems with callbacks scoping.

Yeah, some of our guys internally LOVE haxe :smiley:

Our goal with languages like these are to make sure Fuse can support basically any language that compiles to JS without hassle in the very near future. Haxe is definitely one we’ve got our eye on, as well as the ongoing effort in the community to develop proper TypeScript definitions that started with the VS code plugin.

Anyways, we love seeing this stuff, and we hope our platform can enable users to choose additional languages at their own discretion. I, for one, would also like to use F#, as that’s one of my favorite languages personally :smiley:

Thanks for sharing!

Oh hey, I seem to have missed your proof-of-concept link last time I saw this. Double thanks for sharing that as well :smiley: This is great stuff!!

Really cool to see how you were able to get this working so cleanly. Hopefully some of the features we’re discussing internally to extend the live reload system to allow precompilation of other languages to JS on-the-fly will make this even easier and cleaner (for haxe and other languages as well!).

Anyways, again, love seeing this stuff. Hopefully it can even inspire others in the haxe community to give our stuff a shot as well :slight_smile: