2.4.2 Class Notation for Structure Types

When defining a structure type, Haxe allows the use of the same syntax described in Class Fields. The following typedef declares a Point type with variable fields x and y of type Int:

typedef Point = {
    var x : Int;
    var y : Int;
}
since Haxe 4.0.0

The fields of a structure may also be declared with final, which only allows them to be assigned once. Such a structure will only unify with other types if the corresponding fields are also final.