Float); Abstract types The latest addition to the Haxe type system is a concept termed abstract types. As used in Haxe, this refers to something different from a conventional abstract type. They are used to make conversions between types implicit, allowing reuse of existing types for specific purposes, like implementing types for units of measurement. This greatly reduces the risk of mixing up values of the same underlying type, but with different meanings (e.g., miles vs. km). The following example assumes that the metric system is the default, while a conversion to miles is needed for legacy data. Haxe can automatically convert miles to kilometers, but not the reverse. abstract Kilometer(Float) { public function new(v:Float) this = v; } abstract Mile(Float) { public function new(v:Float) this = v; @:to public inline function toKilometer():Kilometer return (new Kilometer (this / 0.62137)); } class Test { static var km:Kilometer; static function main(){ var one100Miles = new Mile(100); km = one100Miles; trace(km); // 160.935 } } As the example shows, no explicit conversion is needed for the assignment "km = one100Miles;" to do the right thing. Structural typing In many functional programming languages, structural typing plays a major role. Haxe employs it in the presence of anonymous types, using the nominative typing of object-oriented programming, when only named types are involved. Anonymous types in Haxe are analogous to the implicit interfaces of the language Go as to typing. In contrast with Go interfaces, it is possible to construct a value using an anonymous type. class FooBar { public var foo:Int; public var bar:String; public function new() { foo = 1; bar = "2"; } function anyFooBar(v:{foo:Int, bar:String}) trace(v.foo); static function test() { var fb = new FooBar(); fb.anyFooBar(fb); fb.anyFooBar({foo: 123, bar: "456"}); } } Internal architecture The Haxe compiler is divided into one frontend and multiple backends. The frontend creates an abstract syntax tree (AST) from the source code, and performs type checking, macro expansion, and optimization on the AST. The various backends translate the processed AST into source code or generate bytecode, depending on their target. The compiler is written in OCaml. It can be run in server-mode to provide code completion for integrated development environments (IDEs) and maintain a cache, to further speed compiling. See also Comparison of IDE choices for Haxe programmers Dart (programming language) Nim (programming language) Opa (programming language) Clojure CoffeeScript TypeScript Scala (programming language) Vala (programming language) Emscripten