Release Notes

Dear Community,

On behalf of the Haxe Foundation, we are proud to announce the official release of the Haxe 4.0.0-preview.3! It is available along with the changelog at

As a preview release, it should not be considered stable. However, we appreciate anyone testing this version which will help us with the real Haxe 4 release. Please report any issues here:

Thank you very much for your help!

The most important change of this preview release is the new function type syntax. It was proposed by Dan Korostelev and successfully passed through Haxe Evolution process.

The new syntax provides a natural way for declaring function types with support for argument names which allows to create more readable self-explaining code:

// no arguments
() -> Void

// single argument
(name:String) -> Void

// multiple (also, optional) arguments
(name:String, ?age:Int) -> Void

// unnamed arguments
(Int, String) -> Bool

// mixed arguments, why not
(a:Int, ?String) -> Void

While the old function type syntax is still supported, we would advise using the new one for writing new code.

Since this preview, the final keyword is allowed in anonymous structure syntax using class notation:

    /** ordinary field */
    var field1:Int;
    /** Immutable field */
    final field2:String;

This release also makes a few steps towards replacing untyped code:

There are new js.Syntax.code(), php.Syntax.code() and other methods, which should be used for platform specific syntax that is not naturally achievable using Haxe syntax. The Syntax classe - unlike the untyped keyword - is type-safe and analyzer-friendly.

The JavaScript target got performance optimizations for its x.iterator() and, MyClass) calls. The first one improves iteration over Iterable<T>, the second one is compiled to plain value instanceof MyClass instead of a function call where possible.

SSL support was added to HTTP requests for the Python target.

The PHP target does not need to call Reflect.compareMethods() anymore. Starting from this preview any functions can be compared with the == operator, just like it is done for most of the other targets.

Of course, numerous other improvements and bugfixes were implemented. For more details, please refer to the changelog.

Change Log

2018-02-23: 4.0.0-preview.3

See full commit history at, notable changes below:

New features:

  • all : added new function type syntax ((a:Int, b:String)->Void) (#6645)
  • all : added column to StackItem.FilePos (#6665)
  • all : added -D warn-var-shadowing
  • all : added haxe.Log.formatOutput (#6738)
  • js : added js.Syntax class for generating unsupported JavaScript syntax in a type-safe analyzer-friendly way
  • js : added js.Map and js.Set and js.JsIterator extern definitions (ES6)
  • hl : added hl.Format.digest, use it for native Sha1/Md5

General improvements and optimizations:

  • all : made all non-warning/non-error compiler messages output to stdout (#4480)
  • all : make DCE keep constructor if any instance field is kept (#6690)
  • all : make final in structures use class notation
  • display : added this and super to toplevel completion (#6051)
  • php : implemented direct method comparison. No need to use Reflect.compareMethods()
  • php : added php.Syntax.code() instead of deprecated untyped __php__() (#6708)
  • php : added methods to php.Syntax for each php operator: ??, ?:, ** etc. (#6708)
  • python : add ssl support for http requests
  • python : improve Sys.print(ln) code generation (#6184)
  • js : generate faster code for x.iterator() calls (#6669)
  • js : rework exception handling, added js.Lib.getOriginalException (#6713)
  • js : generate value instanceof MyClass instead of, MyClass) (#6687)
  • js : use lazy getter for HaxeError.message instead of calling String(val) in the ctor (#6754)


  • php : removed php.Syntax.binop() (#6708)


  • php : deprecated support for untyped __php__, untyped __call__ etc. Use php.Syntax instead.


  • all : delay interface accessor generation properly (#6225, #6672)
  • all : fixed unbound variable error in anonymous functions (#6674)
  • all : fixed abstract @:to used when from is available in a specific case (#6751)
  • all : sys.Http: fix chunked encoding handling (#6763)
  • all : fix some invalid Json being accepted by haxe.format.JsonParser (#6734)
  • all : fixed haxe.format.JsonPrinter for instances of classes to make it produce consistent result across targets (#6801)
  • all : fixed autogenerated constructor for extending @:structInit classes (#6822, #6078)
  • js : fixed saving setter to tmp var before invocation (#6672)
  • lua : fix toString behavior in the case of -0 (#6652)
  • lua : properly bind field functions when passed as arguments (#6722)
  • php : don't fail on generating import aliases for classes with the similar names (#6680)
  • php : fixed Sys.environment() to also return variables set by Sys.putEnv()
  • php : fixed (#6693)
  • php : fixed appending "sqlite:" prefix to the names of files created by (#6692)
  • php : made php.Lib.objectOfAssociativeArray() recursive (#6698)
  • php : fixed php error on parsing expressions like a == b == c (#6720)
  • php : fixed multiple file uploads in php.Web.parseMultiPart() (#4173)
  • php : fixed an issue with "Object" used as a class name for PHP 7.2 (it's a new keyword in php) (#6838)
  • eval : don't lose dynamic function inits from parent classes (#6660)
  • cs : fix order-dependent enum type parameter issue (#6016)