Hacker News new | past | comments | ask | show | jobs | submit | Gama11's comments login

I work with Kotlin at my day job but am also active in the Haxe open source community. I really like both languages, and I don't think that Kotlin is objectively better than Haxe.

In practice, there are things about Haxe I miss in Kotlin, but also things about Kotlin I miss in Haxe. Just to name a few examples:

- I'm missing Haxe's pattern matching and macros in Kotlin

- I'm missing Kotlin's level of IDE support and robust null safety (with ?: and ?. operators) in Haxe

(Haxe does have experimental opt-in null safety, but it doesn't seem production-ready yet)


"there’s no equivalent project to DefinitelyTyped" - no, but these days you can auto-convert those TS type definitions to Haxe externs automatically! :)

https://github.com/haxiomic/dts2hx


Oh I’ve got to give that a go!


Haxe macros are very powerful, but not needed for that particular issue - the compiler supports inlining of methods and even constructors (which is useful for iterators in particular): https://haxe.org/manual/lf-inline-constructor.html


It is. On targets such as C++ where there's no native GC, Haxe brings its own (via hxcpp in this case: https://github.com/HaxeFoundation/hxcpp).


For 5 of the targets, debugging directly within the Haxe sources is supported with different VSCode debug adapters (well, JS just uses source maps). If your code is written in a target-agnostic way, you can even switch to a different target with better debugging support temporarily.

https://github.com/vshaxe/vshaxe/wiki/Debugging

Other than that, if really you need to debug some target-specific issue on a target without debugging support, there's usually still the option of debugging the generated code.


oh, I see, thanks! Since I assume you're one of the devs, can you pinpoint also to a direct AST evaluator implementation? Either the obsolete --interp or the new "Eval" interpeter engine :)


The eval implementation is found here (evalMain.ml is the entry point):

https://github.com/HaxeFoundation/haxe/tree/development/src/...


Fyi, at this point the Neko VM has more or less been replaced by its spiritual successor HashLink (used by games such as Northgard and Dead Cells). It achieves better performance by being a strictly typed VM. It also has better tooling (breakpoint debugging in VSCode, profiling).

https://hashlink.haxe.org/


TypeScript makes a number of compromises to achieve optimal JS compatibility. Haxe doesn't have this goal since JS is just one of its many targets, and this shows in a number of design decisions (everything-is-an-expression, ADTs and pattern matching, etc).


There are Electron applications written in Haxe too (via the JS target and Node + Electron type definitions), such as these two level editors for games:

- LDtk: https://ldtk.io/

- Ogmo 3: https://ogmo-editor-3.github.io/


Haxe is hardly a "scripting language", at least according to my definition of that term. It's a strictly typed high-level language with a proper optimizing compiler. Depending on the target it produces either bytecode (Neko, HashLink, Flash and recently JVM) or source code (C++, JavaScript, Python, Lua, C#, Java, PHP).

See https://haxe.org/documentation/introduction/compiler-targets... for a full list of targets.


Yeah sorry, like I said, never did look closely into either of them before. Knew that Haxe had multiple targets but aside from Neko and Flash and JavaScript I didn’t remember the others. Should’ve checked the Haxe website also.


No worries, just wanted to clear up the misconception. :)


Haxe's JavaScript target works great in combination with Node as well though. :) (https://github.com/HaxeFoundation/hxnodejs)

For instance, the Haxe VSCode extension itself is a Node project written in Haxe.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: