Targeting HTML5, Haxe NME vs Script#?

810 views Asked by At

I would like to know, which is the wise decision to take when choosing Haxe NME or Script# to work with HTML5?

I know there benefits of Haxe over AS3, but what about Script#? whats the limitations vs real C#?

Dose Script# support generic types? Can I still use generic types in Haxe to target HTML5?

Any idea around the topic is highly appreciated!

2

There are 2 answers

3
back2dos On BEST ANSWER

The one reason to use Script# is if you like C# so much that you would like to use it for JavaScript development, even if you only get to use a subset of it. That's for you to decide. Such small and young projects thrive on enthusiastic users, who dare to test them in the field.

Personally, I use Haxe since about 4 years now, and these are the advantages I see:

  • Haxe development has started over seven years ago and the compiler team has grown to six members. It is a mature tool, with a lot of momentum, a very active and friendly community and quite an eco-system, especially now that the decline of the FlashPlayer has created a rather big influx of AS3 developers
  • Haxe is richer in features:
    • generics
    • function types
    • algebraic data types
    • abstract data types
    • structural subtyping
    • lisp-style macros
  • Haxe targets a multitude of platforms and languages: i.e. JavaScript, ActionScript, PHP, C++, Java, C#, FlashPlayer and NekoVM (the Java and C# backend still being alpha). You can use the language to target virtually any platform. You can use compatibility layers such as NME to run the same app on any mobile device or in the browser through FlashPlayer or HTML5. Script# will only ever spit out JavaScript - that being said C# does also run on a couple of devices ;)

So I do think Haxe is better, but if you love the idea of Script#, then you shouldn't be discouraged from pursuing it.

If you're really just looking for the best tool, then I suggest you choose between Haxe and TypeScript. The latter - while also considerably poorer in features - does an excellent job at mapping JavaScript to a relatively robust type system.

2
thSoft On

Regarding generics, according to this issue, Script# doesn't support them yet, while Haxe does. Otherwise, they are very similar, so I suggest to pick the one which your are more familiar with.