Released: 2019-10-26
Thank you for choosing Haxe!
Download for your platform and start developing today.
A newer version is available!
The latest stable version is Haxe 4.3.6.
Dear Community,
On behalf of the Haxe Foundation, we are proud to announce the official release of the Haxe 4.0.0!
We have worked for almost two years on this version. We shipped 5 preview and 5 release candidate versions, each with new and improved features and bugfixes and we have now reached a point where we can present a stable release!
Haxe 4.0.0 includes some of our most highly-requested features:
final
keywordTo migrate from Haxe 3, read the overview of breaking changes.
See the changelog below for further details. If you have any suggestions or run into any problems, don’t hesitate to open an issue on GitHub.
We want to thank everyone involved and hope to see your codebases transition to Haxe 4 soon!
New features:
-D warn-var-shadowing
--macro nullSafety("package")
(#7717)(a:Int, b:String)->Void
) (#6645)@:op(a.b)
enum abstract
syntax instead of @:enum abstract
(#4282)extern
on fields instead of @:extern
@:using
on type declarations (#7462)for (key => value in e)
syntax for key-value iteratorsinline call()
and inline new
expressions (#7425)Type1 & Type2
intersection syntax for type parameter constraints and structures (#7127)for (i in 0...5)
(#7365)-D js-es=6
(#7806)General improvements and optimizations:
this
(#6036)operator
and overload
as keywords (#7413)@:bypassAccessor
haxe4
definecase var x
syntax and detect possible typos (#6608)@:commutative
on non-static abstract functions (#5599)var ?x
and final ?x
parsing in structures (#6947)#if (a.b)
(#8005)[]
where Map
is expected (#7426)for
loop unrolling (#3784)null
switch
and case
expressions (#7947)@:native
for overriden methods (#7844)@:expose
imply @:keep
(#7695)@:using
actually workfinal
on structure fields invariant (#7039)final
in structures use class notation.
, e.g. @:a.b
. This is represented as a string (#3959)final
(#8335)@:op(a = b)
(#6903)override
field (#7847)@:pure(false)
on variable fields (#8338)override |
completion#if target.sys
this
and super
to toplevel completion (#6051)final
, enum abstract
and haxe.extern.Rest
)value instanceof MyClass
instead of Std.is(value, MyClass)
(#6687)x.iterator()
calls (#6669)then
callback argument types can be properly inferred (#7644)break
inside switch
inside loops (#4964)-D source-map
flag to generate source maps in release buildsFloat32Array
and Float64Array
(#8864)@:persistent
to keep macro static values across compilationsphp.Syntax.code()
instead of deprecated untyped __php__()
(#6708)php.NativeStructArray
(#8893)php.Syntax
for each php operator: ??
, ?:
, **
etc. (#6708)--php-prefix
, --php-front
and --php-lib
to -D php-prefix=
, -D php-front=
and -D php-lib=
respectivelyReflect.compareMethods()
Map.copy()
and Array.copy()
Map
and native arrays.php.Syntax.yield()
and php.Generator
database
parameter of Mysql.connect
is now optionalStandard Library:
return this
from some haxe.Http methods (#6980)BalancedTree implements
haxe.Constraints.IMap` (#6231)EReg.escape
(#5098)iterator()
to haxe.DynamicAccess
(#7892)keyValueIterator()
to haxe.DynamicAccess
(#7769)resize
to Array (#6869)Std.downcast
as replacement for Std.instance
(#8301)UnicodeString
, deprecated haxe.Utf8
(#8298)js.html
to js.lib
(#7894)Bugfixes:
function () { }(e)
is no longer parsed as a call (#5854)inline
handling (#7155)return null
from Void-functions (#7198)final
fields (#7182)-D no-deprecation-warnings
for typedefs and enums@:allow(package)
allowing too much (#8306)from Dynamic
on abstracts (#8425)inline new
handling (#8240)Null<T>
inconsistency in if/ternary expressions (#6955)@:to
used when from
is available in a specific case (#6751)this
modification in inline methods (#8454).match
(#7921)@:structInit
classes (#5449)@:generic
field access (#6430)super
(#3607)@:generic
type parameters not being bound to Dynamic (#8102)@:from
methods allowing any return type (#8463)untyped
and type parameters (#7113)@:structInit
@:from
methods on abstracts (#8779)this
(#8781)protected
handling and method overloadingEReg.replace
(#3430)Map
constraint checks (#7781)value.iterator--
(#6637)tmp
var before invocation (#6672)instanceof
(#7653)@:expose
for classes inside packages (#7849)EReg.map
for unicode (#8861)StringTools.fastCodeAt
with -D lua-vanilla
(#7589)$
in field names of anonymous objects (#7230)-2147483648
as init value for static vars (#5289)Sys.environment()
to also return variables set by Sys.putEnv()
sys.net.Socket.bind()
(#6693)static inline var
via reflection (#6630)sys.db.Sqlite.open()
(#6692)a == b == c
(#6720)switch
as if...else if...else...
to avoid loose comparison (#7257)new MyClass()
expressions wrapped in a cast
(#6294)@:enum abstract
generation without -dce full
(#6175)null
property access (#6281)Removals:
\x
with values > 0x7F (#8141)implements Dynamic
on non-extern classes (#6191)@:fakeEnum
enums--gen-hx-classes
(#8237)-D use-rtti-doc
, always store documentation instead (#7493)T:(A, B)
constraint syntaxuntyped __php__
, untyped __call__
etc. Use php.Syntax
instead.php.Syntax.binop()
(#6708)record-macros
(https://github.com/HaxeFoundation/record-macros)