Haxe 4.2.0 is released!

Dear Community,

On behalf of the Haxe Foundation, we are proud to announce the official release of Haxe 4.2.0!

It is available along with the changelog at https://haxe.org/download/version/4.2.0/

Here are the most notable features made into this release:

  • Module-level fields (see blog post)

  • “Classic” abstract classes and functions (see haxe-evolution proposal)

  • Rest arguments (variadic functions) for all targets (see the doc for haxe.Rest)

  • many other features (see changelog)

Haxe 4.2.0 also includes dozens of other additions, optimizations, improvements, and bugfixes.

Check out the changelog for more information.

If you have any suggestions or run into any problems, absolutely open an issue on GitHub.

Thanks to everyone involved!

31 Likes

I absolutely love module-level fields, fantastic release everyone.

Could you shed some more light on the following:

  • jvm : added -D jvm.dynamic-level to control the amount of dynamic support code being generated. 0 = none, 1 = field read/write optimization (default), 2 = compile-time method closures
1 Like

This is in the context of dynamic access to methods. Each class generates a _hx_getField method for read-access, which you can pretend looks something like this:

return switch (fieldName) {
    #if (jvm.dynamic_level >= 1)
    case "someVariable": this.someVariable;
    #end
    #if (jvm.dynamic_level >= 2)
    case "someMethod": new CurrentClass_someMethod(this);
    #else
    case "someMethod": haxe.jvm.Jvm.readFieldClosure(this, "someMethod", [argumentTypes]);
    #end
    default: // Slow dynamic default routing
}

In other words, with a level >= 2 you’ll get a compile-time closure instance for every method. This can make things faster in highly dynamic code, but it definitely makes the output much bigger.

3 Likes

Congrats on the release. It’s very pleasant to write code in Haxe, and I think module-level functions is a good addition.

I hope the tooling and libraries get updated soon.

1 Like

thanks for all the good work !

1 Like

Those are some nice language features added, cool.

Haxe really has potential in the next couple years to show it’s mature and robust.

We all should show some love to the compiler devs, it’s plumbing. :slight_smile:

Thanks @Simn !

3 Likes

Thanks for breaking that down. :grinning:

1 Like

Great update. :partying_face: A great thanks to everybody. :grinning:

1 Like