Just sharing one of the things I have been working on lately: it’s called
interpret, an utility to dynamically load Haxe classes as script and to add live-reload capability to your projects.
You can find out more about it here: https://github.com/jeremyfa/interpret/ and give it a try by installing it from haxelib
haxelib install interpret
A few words on how it works: interpret can load haxe code as raw text, extract info from it (imports, usings, classes, methods, vars…) and perform required conversions to generate valid hscript code, then execute it with a custom hscript interpreter. Haxe compiler is not required to load a script as everything is embedded in the host app (of course you need haxe to build the initial host app ).
It is pretty experimental for now, but it got a batch of unit tests that pass and should be usable and work on any target that haxe supports (only tested js, c++ and --interp for now though, but should work on other targets as well, let me know if it doesn’t).
Note that because it is based on hscript, it doesn’t support every haxe feature, but there have been some work done to make it behave more and more like standard haxe code, and this will be improved further. At the moment, you can expose native classes and abstracts to your interpreted code and import them on your interpretable code (abstract are boxed in scripts to make field resolution possible at runtime). Static extensions are also working up to a certain point (you can for example expose StringTools module then add a
using StringTools in your interpreted code and call
"hello ".trim()). String interpolation works ; Exposing enums and executing switch with pattern matching is planned in the future.
If you want to give it a try, let me know how it goes for you. And feel free to reply here if you have any question/feedback about it!