Skip to content

Breaking changes in Haxe 3.3.0

Dan Korostelev edited this page Apr 4, 2016 · 11 revisions

Pattern matching

  • "Constant expression expected": The compiler no longer allows matching on non-inline fields unless they are read-only ((default, never)).
  • Pattern resolution order is now consistent with resolution order for normal typing. This might resolve an unqualified identifier pattern differently. Refer to http://haxe.org/manual/type-system-resolution-order.html for more information on how resolution order works.

Macros

  • @:enum abstract types are now transformed after their build macro has run. Build macros should no longer manually add @:impl and make the field static/inline.

Typing

  • Dynamic is now checked for when overriding or implementing fields in order to avoid variance violations.
  • typedef types are no longer checked eagerly. This might delay execution of some @:build or @:genericBuild macros. Note that type building order is undefined anyway.

Miscellaneous

  • Modifying a Map while iterating is no longer specified.

JavaScript standard compilance

Haxe now generates JavaScript code for ECMAScript 5 (ES5) compliant runtimes by default (this was enabled with -D js-es5 before).

This means that it can break for some browser that doesn't support ES5, such as Internet Explorer 8 and earlier. To keep ES3 compatibility, use the new define -D js-es=3.

If not set manually, js_es value will be set to 5 by default. In future, this define will be used for generating JS code for more modern standard versions.

When writing JS specific code, you can use conditional compilation expressions like #if (js_es >= 5) to have different implementations for different ES versions. The old js_es5 define is kept for backward-compatibility when js_es is equal or greater than 5, however it's advised to use the new js_es define instead.