Main differences between Haxe and Nim?

Nim and Haxe share many things. To your list I would add:

  • a powerful macro system
  • generics

where they differ is :

  • Nim generic is template based, which gives you more power
  • Nim has no real working OOP yet, but you can create OOP easily with the macro system
  • Nim generics support static[T] which is nice
  • Nim has build in yield in the iterator
  • Haxe is much mature and reaches version 4. Nim is struggling to reach version 1
  • Haxe has pattern matching build in. Nim does this with macro and libraries
  • Haxe has Enum as ADT, Nim has object variants. I like Haxe approach much more.
  • Nim allows more low-level programming. you can switch off GC, have manual memory management and have different GCs available (ref counted, mark and sweep, boehm, real time).
  • Haxe has a static analyzer and very good inliner. Nim relies on the backend compiler to do the job until now. When targeting C or C++ Nim code is in general a bit faster than Haxe (less overhead, better memory handling, no Dynamic). On JS I would claim that Haxe is better
  • Haxe has a much more options for the backend

So its a matter what you are doing. For system level programming I would choose Nim. For UI, client side, cross platform or games I would choose Haxe. Both are nice and I use both.

6 Likes