Hi all,
I’ve written a dense matrix + vector library that is primarily meant to be used within larger Haxe programs and libraries, but I do also intend to use it as an importable module in Lua for REPL interactivity (as well as eventually in Node, JVM languages, and C++).
I can build it as an importable library for Lua already using the Haxe command like so:
haxe --lua dense_linear_algebra.lua --class-path src dense/Vector.hx dense/Matrix.hx
And then after entering a Lua REPL, can utilize it like so:
dla = require 'dense_linear_algebra'
Vector, Matrix = dla.dense.Vector, dla.dense.Matrix
vec = Vector.generate(7, function(i) return i * 5.0 + 1 end)
vec:get(4)
vec:dotProduct(vec)
vec:normalize()
It builds fine in that manner, and I’m already successfully using it that way. I guess where I’m stuck is that in HXML, I don’t know how to include stray files like that without there being a “–main” option. I’ve tried using a “–macro include(‘dense/Vector.hx’)” but the file output is quite different in both content and behavior (and I’m not even sure that is the proper option to use in the first place).
I can of course write shell scripts but those aren’t as portable (for those using Windows) and I’d like to stay in the Haxe ecosystem nonetheless while still automating the process.
What is the proper way to accomplish this? Also, where is the best place to understand the nuances and options associated with HXML? I can of course see the intro in the guide, but I know I’ve seen more options elaborated on somewhere else before and just cannot locate it again. Of course diving into the codebase is always an option. I’ll be writing a series of libraries in this manner so this solution is something that I will get a lot of mileage out of.
Thanks for any guidance here!