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.4! It is available along with the changelog at https://haxe.org/download.

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:

https://github.com/HaxeFoundation/haxe/issues.

Thank you very much for your help!

Improved compiler display services

Our focus for this release has been compiler display services. We implemented a new, JSON-RPC-based protocol which is utilized by the vshaxe Visual Studio Code Extension to provide a variety of new features:

  • Support for auto-import
  • Completion on override |
  • Completion for structure field names
  • Support for auto-generating structure declarations, functions, switches and more
  • Context-aware, sorted toplevel completion
  • Reference finding which explores modules that are not necessarily part of the compilation

Improved enum abstracts

Enum abstracts now get the treatment they deserve with a proper enum abstract syntax. Furthermore, values can now be omitted if the enum abstract is defined over Int or String:

enum abstract MyEnum(String) {
    var MyValue; // implicit = "MyValue"
}

enum abstract MyOtherEnum(Int) {
    var MyValue0; // implicit = 0
    var MyValue1; // implicit = 1
    var MyValue5 = 5;
    var MyValue6; // implicit = 6
}

Various syntactic improvements

  • extern is now recognized as a field-level modifier and can be used instead of @:extern
  • Metadata names can now use dots, e.g. @:haxe.json becomes a metadata entry named "haxe.json"
  • Structure fields now consistently allow var ?x and final ?x, meaning the same as @:optional var x
  • Type1 & Type2 is now a recognized syntax for intersection types. For the time being, it is only supported to merge structures (replacing the { >Type1, >Type2, } syntax) and for type parameter constraints (replacing T:(Type1, Type2) which has been removed from the language).

Lots of bugfixes

See the changelog for more!

Change Log

2018-06-12: 4.0.0-preview.4

New features:

  • all : added JSON-RPC-based display protocol
  • all : allow enum abstract syntax instead of @:enum abstract (#4282)
  • all : allow extern on fields instead of @:extern
  • all : support signature completion on incomplete structures (#5767)
  • all : support auto-numbering and auto-stringification in enum abstracts (#7139)
  • all : support Type1 & Type2 intersection syntax for type parameter constraints and structures (#7127)

General improvements and optimizations:

  • all : reworked CLI usage/help output (#6862)
  • all : implemented for loop unrolling (#3784)
  • all : metadata can now use ., e.g. @:a.b. This is represented as a string (#3959)
  • all : [breaking] disallow static extensions on implicit this (#6036)
  • all : allow true and false expressions as type parameters (#6958)
  • all : improved display support in many areas
  • all : support override | completion
  • all : make display/references and display/toplevel actually work sometimes
  • all : allow var ?x and final ?x parsing in structures (#6947)
  • all : improved overall robustness of the parser in display mode
  • all : allow @:commutative on non-static abstract functions (#5599)
  • js : added externs for js.Date (#6855)
  • js : respect -D source-map flag to generate source maps in release builds
  • js : enums are now generated as objects instead of arrays (#6350)
  • eval : improved debugger, support conditional breakpoints

Removals:

  • all : moved haxe.remoting to hx3compat
  • js : moved js.XMLSocket to hx3compat
  • neko : moved neko.net to hx3compat
  • all : removed support for T:(A, B) constraint syntax

Bugfixes:

  • all : fixed various issues with diagnostics
  • all : fixed fields with default values for @:structInit classes (#5449)
  • all : fixed Null<T> inconsistency in if/ternary expressions (#6955)
  • all : fixed visibility check related to private constructors of sibling classes (#6957)
  • all : fixed @:generic naming (#6968)
  • all : fixed handling of type parameters in local functions (#6560)
  • all : fixed resolution order between untyped and type parameters (#7113)
  • all : fixed unification behavior in try/catch expressions (#7120)
  • all : fixed field type being lost for Int expressions on Float fields (#7132)
  • all : cleaned up inline handling (#7155)
  • display : fixed completion in packages starting with underscore (#5417)
  • php : fixed Reflect.callMethod with classes as first argument (#7106)
  • eval : fixed internal exception surfacing in some context calls (#7007)
  • eval : fixed Type.enumEq (#6710)
  • flash : fixed silently swallowing exceptions in getters/setters when invoked with Reflect methods (#5460, #6871)

Standard Library:

  • all : added resize to Array (#6869)
  • all : [breaking] removed return this from some haxe.Http methods (#6980)