What’s New in Haxe 3.3.0 RC1?

by Skial Bainn published on

The Haxe Foundation officially released Haxe 3.3.0 RC1 on 27th May 2016. Among the various bug fixes and general improvements the following are, in my opinion, the most notable additions in Haxe 3.3.0.

Lua Target

One of the two newest compiler targets is the Lua target by Justin Donaldson, who has written Hello Lua! over on the HF blog covering getting setup, what Lua versions are supported and more.

You can read more about Justin’s work on writing the Lua target in his recent WWX 2016 Interview.

HL Target

The mysterious HL target, the second newest compiler target, compiles to C and to a brand new interpreter, both created by Nicolas Cannasse.

The only thing that is known is that Kha can compile and run Tetris in HL.

Cppast

Even though this is listed under General improvements and optimizations, Hugh Sanderson has rewritten the entire backend that generates CPP code, which is largely a cosmetic change. Any performance improvements will come from Hugh’s recent release of HXCPP 3.3.46 available now from HaxeLib, accompanied by NME, AcadNME, GM2D and NME-ToolKit releases.

For more information on optimizations and performance improvements you’ll have to wait until Hugh’s WWX 2016 slides are available or the talk is published online.

import.hx

A brand new feature, also known as defaults, allows you to define import's and using's that get applied to all modules inside your directory.

Thankfully, Dan Korostelev has written all about import.hx over on the HF blog.

Abstract @:resolve & @:op(a.b)

Abstracts can now resolve dot access either at runtime, using the @:resolve meta or during the macro context with an operator overload using @:op(a.b). Compiling the following code to JavaScript.

Results in the following output, edited for brevity.

Pretty powerful.

Abstracts extern & @:native

You can now use abstracts as externs. The HF unit test Issue4862.hx demonstrates this perfectly.

Using @:native metadata, the abstract is renamed to match the extern object and by using it as an @:enum you gain all the pattern matching abilities but on a native type.

The is Keyword

A brand new keyword has been added, is, used like (expr is Type). Currently this gets translated to Std.is(expr, Type). As far as I’m aware, this has been added as progress towards Haxe 4.0.