The newest addition to the list of Haxe targets is the Python target. The compiler team still class it as a beta target, so if you run into any problems file an issue.
Lets see a rather trivial example.
haxe -python Main.py -main Main will generate the following python.
To help improve the accuracy of external type definitions, the compiler team have added two new types,
haxe.extern.EitherType, also two new compiler metadata,
extern part of the packages, these two types are only ever expected to be used with extern types.
Taking the extern file
python.lib.os.Path as an example, its method join looks like the following.
public static function join(path:String, paths:Rest<String>):String;
This allows you pass in an optional amount of arguments of type
js.html.Blob as an example, its constructor, on line 11, looks like the following.
This allows you to pass in an array containing any object that is either a
@:selfCall compiler metadata gives you the ability to tag an extern class constructor and method which tells the compiler to translate it into an object call. The following example should help clear up any confusion.
Notice how the methods of
extern class A and
extern class B are generated differently.
@:callable compiler metadata allows an abstract type to be called, which will forward that call to its underlying type. If you try to compile this without the
@:callable metadata you will get the following error message
Function<Int -> Int> cannot be called.
For those of us who use macros, Compiler.addGlobalMetadata allows you to attach metadata to any type or method that hasn't been processed by the compiler. This makes macros even more powerful.
The Haxe Foundation have a complete set of extern type definitions covering NodeJS
0.12. You get automatic insertion of
require statements, optionally typed event listeners and a clean output. To grab a copy just run
haxelib git hxnodejs https://github.com/HaxeFoundation/hxnodejs.git from the command line.
The Haxe API site has been updated with an improved design and functionality which is an enhanced version of the Flambe API site and template. You can get the latest code for Dox, the official Haxe API generator, from GitHub.
HaxeLib has recently added mercurial support to its GitHub repository. Its recommended to wait for the haxelib client to be updated instead of installing via
git. The hard work of adding mercurial to HaxeLib was contributed by Alex Koz.