Haxe to OCaml

I’m trying to use haxe to compile to Ocaml, and then from Ocaml to native code. At present, I have implemented some compilation contents.

Github:GitHub - rainyt/ocaml-haxe: 使用Haxe编写OCaml代码

At the same time, I’m simulating some sys API, such as file. Of course, the project is only for learning to use. I also need to learn the content of Ocaml.


Today, I imitated the file system API and solved some processing of some type returns.

I’m trying to translate the construction of new class() into Ocaml; Here I still use method access.

Later I’ll try how to access methods in objects.

Did you consider using OCaml classes? I don’t know how well they map to Haxe, but it would save you the trouble of reimplementing OO-semantics.

Yes, I’ll try. :grinning:


At present, I temporarily use the access method to implement object-oriented content. The variable initialization value is now implemented.

And the method access of object is realized,

var process2 = new Process("haxelib -help");
var data2 = process2.readAllString(">>>><<<");
trace(process2.getProcess2().name);