Haxe
Paradigm | Multi-paradigm: object-oriented, functional, generic |
---|---|
Family | ECMAScript |
Developer | Haxe Foundation |
First appeared | November 14, 2005 |
Stable release | 4.3.6[1]
/ 7 August 2024 |
Typing discipline | static, dynamic via annotations, nominal |
Scope | lexical |
Implementation language | OCaml |
Platform | IA-32, x86-64, AArch64, armel, armhf, MIPS, MIPS64el, MIPSel, ppc64el, RISC-V, s390x |
OS | Android, iOS; Linux, macOS, Windows |
License | GPL 2.0, library: MIT |
Filename extensions | .hx, .hxml |
Website | haxe |
Influenced by | |
ECMAScript, JavaScript, ActionScript, OCaml, Java, C++, PHP, C#, Python, Lua, NekoVM |
Haxe is a high-level cross-platform programming language and compiler that can produce applications and source code for many different computing platforms from one code-base. It is free and open-source software, released under an MIT License.[2] The compiler is written in OCaml. It can be run in server-mode to provide code completion for integrated development environments (IDEs). [3]
Haxe includes a set of features and a standard library[4] supported across all platforms, including numeric data types, strings, arrays, maps, binary, reflective programming, maths, Hypertext Transfer Protocol (HTTP), file system and common file formats. Haxe also includes platform-specific application programming interfaces (APIs) for each compiler target.[5] Kha, OpenFL, and Heaps.io are popular Haxe frameworks that enable creating multi-platform content from one codebase.[6]
Haxe originated with the idea of supporting client-side and server-side programming in one language, and simplifying the communication logic between them.[7] Code written in Haxe can be compiled into JavaScript, C++, Java, JVM, PHP, C#, Python, Lua[8] and Node.js.[9] Haxe can also directly compile SWF, HashLink, and NekoVM bytecode and also runs in interpreted mode.[10]
Haxe supports externs (definition files) that can contain data type information of extant libraries to describe target-specific interaction in a type-safe manner, like C++ header files can describe the structure of existing object files. This enables to use the values defined in the files as if they were statically typed Haxe entities. Beside externs, other solutions exist to access each platform's native capabilities.
Many popular IDEs and source code editors have support available for Haxe development.[11] No particular development environment or tool set is officially recommended by the Haxe Foundation, although VS Code, IntelliJ IDEA and HaxeDevelop have the most support for Haxe development. The core functionalities of syntax highlighting, code completion, refactoring, debugging, etc. are available to various degrees.
History
[edit]Development of Haxe began in October 2005. The first alpha version was released on November 14, 2005.[12][13] Haxe 1.0 was released in April 2006, with support for Adobe Flash, JavaScript, and NekoVM programs. Support for PHP was added in 2008, and C++ was added in 2009. More platforms such as C# and Java were added with a compiler overhaul in 2012.
Haxe was developed by Nicolas Cannasse and other contributors, and was originally named haXe[14] because it was short, simple, and "has an X inside", which the author asserts humorously is needed to make any new technology a success.[15]
Haxe is the successor to the open-source ActionScript 2 compiler MTASC,[16] also built by Nicolas Cannasse and is released under the GNU General Public License version 2 or later.
Compiler
[edit]The Haxe language can compile into bytecode that can be executed directly by the virtual machines it targets. It can compile to source code in C++, JavaScript, PHP, C#, Java, Python, and Lua. Haxe also has an interpreter called eval.[17] This same interpreter is also used compile-time to run macros, which allow modification of the abstract syntax tree (AST).
This strategy of compiling to multiple source code languages is inspired by the write once, run anywhere paradigm. It also allows the programmer to choose the best platform for the job. Typical Haxe programs run identically on all platforms, but developers can specify platform-specific code and use conditional compilation to prevent it from compiling on other platforms.
The Haxe compiler is an optimizing compiler, and uses field and function inlining, tail recursion elimination, constant folding, loop unrolling and dead code elimination (DCE) to optimize the run-time performance of compiled programs.[18] The Haxe compiler offers opt-in null-safety, it checks compile-time for nullable values. The run-time performance of Haxe programs is at comparable speed to handwritten sources.[19]
See also
[edit]- Dart (programming language)
- Nim (programming language)
- Opa (programming language)
- Clojure
- CoffeeScript
- TypeScript
- Scala (programming language)
- Vala (programming language)
- Emscripten
- OpenFL
References
[edit]- ^ "Release 4.3.6". 7 August 2024. Retrieved 22 August 2024.
- ^ "Open Source licence Haxe".
- ^ Server mode command-line:
haxe --wait [host:]port
- ^ Introduction to the Haxe Standard Library, Haxe Docs
- ^ Target Specific APIs, Introduction to the Haxe Standard Library, Haxe Docs
- ^ Doucet, Lars (2014-06-24). "Dear Adobe: Support Haxe, save your Tools". Gamasutra.
- ^ "Haxe Interview". Io Programmo. 2009-04-01. pp. 1–6. Archived from the original on 2015-12-08. Retrieved 2015-08-06.
- ^ "Hello Lua!". Haxe.org.
- ^ "hxnodejs".
- ^ "Compiler Targets". Haxe. Retrieved 2021-11-05.
- ^ List of IDEs supporting Haxe, Haxe Foundation
- ^ "Release alpha-1". haxe. HaxeFoundation. 2005-11-14. Retrieved 2022-04-02 – via GitHub.
- ^ Cannasse, Nicolas (2005-11-17). "Haxe Alpha 1b". haXe (Mailing list). Archived from the original on 2007-10-26.
- ^ "Nicolas' announcement of spelling change on Haxe official mail list".
- ^ "Haxe mailing list post on naming". Archived from the original on 2007-03-28.
- ^ MTASC Compiler, MTASC website
- ^ "Eval - The new Haxe macro interpreter".
- ^ "Compiler Features".
- ^ Dyachenko, Vadim (2013-12-05). "On "You can't make good HTML5 games in Haxe"". Yellow After Life.
External links
[edit]- High-level programming languages
- Functional languages
- Multi-paradigm programming languages
- Object-based programming languages
- OCaml software
- Pattern matching programming languages
- Programming languages
- Programming languages created in 2005
- Software using the GNU General Public License
- Source-to-source compilers
- Statically typed programming languages