Haxe Features

Here's a not-exhaustive list of Haxe features, use it as a quick overview of the kind of things you can do with it.

Supported Platforms

On the client-side, the following platforms are supported.

  • Can compile to JavaScript by generating a single .js file
    • interactive debugging directly in Haxe sources with JS Source-Mapping (-debug with Haxe 2.09+)
    • highly reduce the script output size with --dead-code-elimination
  • Can compile to C++ source code which is then compiled to native binaries
    • allow to target iOS, Android, and other mobile targets
    • see NME for a good example
  • Can compile to Flash by generating a .swf file, runs usually 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, which enable 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)
  • Include 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 :

  • Classical Object Oriented class + interface model (similar to Java) (more)
  • Strictly typed but with Dynamic support
  • Packages and modules
  • Generics (type parameters) with one or several constraints, but not variance
  • Advanced Type Inference for both all variables including methods arguments / 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), no constraints supported
  • Optional and constant default value function arguments
  • Explicit Inline methods and constant inlined variables
  • Local functions 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

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 let 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, 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's some third party tools or libraries that we recommend using together with Haxe :

version #13913, modified 2012-05-09 13:46:04 by robertbak