Haxe Features

This is a non-exhaustive list of haXe features - use it as a quick overview of the kind of things you can do with haXe.

Supported Platforms

On the client-side, many platforms are supported.

  • Can compile to JavaScript by generating a single .js file
    • interactive debugging directly in Haxe source files with JS Source-Mapping (-debug with Haxe 2.09+)
    • reduce the script output size with --dead-code-elimination
  • Can compile to C++ source code, which can be compiled to native binaries
    • target iOS, Android, and other mobile targets
    • see NME for a good example
  • Can compile to Flash by generating a .swf file - haXe compiled swf files usually run faster than AS3 due to advanced optimizations
    • use interactive debugger if your IDE supports it with -debug -D fdb
    • can compile to SWC and import SWF libraries (produced by IDE or 3rd party libraries)
    • can compile to AS3 source code

On the server-side, you can use Haxe as well, enabling code-sharing and better team communication :

  • Can compile to NodeJS or other server-side JS technologies
  • Can compile to PHP 5, so you can deploy it easily everywhere
  • Can compile to NekoVM by generating a single .n bytecode file
    • a small embedable VM with high performances and small footprint (more)
    • can be run from the commandline or in Apache Web server (with mod_neko or mod_tora)
  • Includes an advanced ORM called SPOD Macros

Language Features

Here's a list of some of the Haxe language features. All these features are tested to run the same on all supported platforms thanks to a lot of unit tests :

  • Classic Object-Oriented class + interface model (similar to Java) (more)
  • Strict typing but with Dynamic support
  • Packages and modules
  • Generics (type parameters) with one or several constraints, but not variance
  • Advanced Type Inference for all variables including methods arguments and return types (except member variables)
  • Anonymous Structures with structural subtyping
  • Strictly typed function types, functions closures and partial applications
  • Polymorphic Methods (per-method type parameters), with constraints
  • Optional and constant default value function arguments
  • Explicit Inline methods and constant inlined variables
  • Local function declarations with this capturing
  • Automatic closure creation
  • Powerful Enums (with constructor parameters and pattern matching)
  • No statements : only expressions
  • Exceptions (try/catch)
  • Metadata
  • Partial function call with callback
  • Getter/Setter and more with Properties
  • Method injection with "using" mixin
  • Conditional Compilation
  • Iterators
  • Syntax shortcuts using Macros.

You can learn more about the different language features by reading the Haxe Language Reference

Standard Library

Haxe comes with batteries included : the crossplatform standard library is quite complete and lets you do many things, such as :

Tools and Libraries

Looking for a given library or want to share one with the community? Look at haxelib, the Haxe library packager system

If you want to customize the way Haxe works, you can use some of these features :

  • compiler-based completion support for easier IDE integration
  • Macros for language customization and compile-time code generation
  • customizable JS output
  • XML output for documentation
  • trace and file position support

Here are some third party tools or libraries that we recommend using with Haxe :

version #19661, modified 2013-08-21 19:44:11 by tarwin