Writing a new target for haxe

Hey all, I’m playing with the idea of producing a Kotlin target for Haxe. I thought I’d try at least copying the Java target under a new name, and then start changing syntax stuff etc. I got haxe building no problem, and wrote a simple patch (9b0b85c — paste.sr.ht) to wire in my new generator in genkotlin.ml which is for now an exact copy of genjava.ml

When I try to use this target I get Please don't add haxe/std to your classpath, instead set HAXE_STD_PATH env var which seems odd… but maybe a result of running inside the haxe source tree? If I comment out that #error in std/Std.hx then the only output is Not_found – enabling verbose and adding some log lines shows that this happens in the call to new_ctx and seems to happen for any call to get_type – so I’m guessing this is maybe related to the stdlib not loading right, but I’m not sure which thing I’ve forgot to set up since AFAICT it should be identical to the java target right now.

Or am I going about this a silly way and I should be looking more closely at @RoBBoR Reflaxe instead?

You tell haxe compiler to use kotlin standard library but you don’t have a kotlin folder in std/ alongside other targets.

I agree the error is weird in this case, but arguably it’s also not something that can happen to “normal users”.

1 Like

Aha, I see that now, thanks! Gives me a path forward to explore at least.