-
-
Notifications
You must be signed in to change notification settings - Fork 662
What's new in Haxe 4
We're introducing the new syntax for specifying function types, now with clear separation of arguments from the return type and with support for argument names, which is very helpful for code self-documenting and better IDE support.
Example:
(name:String, age:Int)->Bool
Note that the old syntax is still supported, but the new one is preferable.
Haxe now finally has the long-awaited arrow function syntax (a.k.a. short lambdas)! This is useful for code that has a lot of "short-and-sweet" callback functions, especially for the code written in the functional paradigm or the code that has to deal with asynchronous operations.
Example:
(a, b) -> a + b
@:nullSafety
final a = 5
(can't mutate)
final class Foo {}
final interface Bar {}
"人".length == 1
faster interpreter -> faster macros and scripts debugging support \o/
bytecode and C, run-time fully conforming to haxe "spec"
inline f()
@:using(MyEnumTools) enum MyEnum {}
@:op(a.b) function(field:String, value:Int):Int
(is that right?)
for (k => v in m) {}
var a = <hi/>;
This will be available for macro processing as @:markup "<hi/>"
.
XML strings are supposed to be parsed with a custom parser.
Simple example to convert XML to string with a macro function: http://try-haxe.mrcdk.com/#19734
{ var ?f:Int; }
enum abstract E(T) {}
enum abstract E(Int) {
var A; // 0
var B; // 1
}
enum abstract E(String) {
var A; // "A"
var B; // "B"
}
extern inline function f(...) {}
Use custom abstracts if you need something like that
A & B
(currently only for structures and type param constraints)
C<T:(A,B)>
now should be C<T:A&B>
var map:Map<Int, String> = [];
var a:haxe.ds.ReadOnlyArray<Int> = [1, 2, 3];
a.push(4); // haxe.ds.ReadOnlyArray<Int> has no field push
more features, json-based, currently undocumented, implemented in haxe language server and used in vshaxe
Learn Haxe: Introduction | Manual | API | Try Haxe | Haxe Library Manager | Code Cookbook
Connect: GitHub | Stack Overflow | Forum | Discord | Gitter | Twitter | Facebook