back
3 comments
I think the honest reason was along the lines of "because I/we can". Many people (myself included) use the Sublime Text Haxe bundle[1], and the plugin is written in Python. Someone started a weekend project to create the Python target so they could rewrite it in Haxe, targeting Python. It got a few contributors on board and suddenly all unit tests were passing.

It does seem slightly odd (many would prefer Python for the language, not the platform), but for those of us more familiar with Haxe, or with existing code/projects in Haxe, being able to target Python means having access to a wider array of libraries, which I guess is kind of cool.

1: https://github.com/clemos/haxe-sublime-bundle

So you can write in Haxe, and then use it in your python projects.
The idea is to be able to write code in one language and use this code in many different languages.
Does it mean that it supports only basic common denominator features of every language? I am a fan of attributes in C# - are Haxe annotations as powerful?
Out of the box Haxe's metadata[1] to me doesn't appear as powerful as C#'s attributes. The big difference is that they are not type safe and are not type-checked by the compiler.

You can however use any expression you want in them, and have macros read them and confirm they are correct, and do whatever you want with them. For example I do some validation on my models:

    @:validate( _.length>0 && _.indexOf(' ')==-1 )
    public var username:String;
As for the bigger question - they are limited in what they can add, but they have many features not in other languages, they just implement them in a syntax-heavy way on the languages that lack such features. Pattern matching is a good example [2].

See http://haxe.org/documentation/introduction/language-features...

[1]: http://haxe.org/manual/lf-metadata.html [2]: http://haxe.org/manual/lf-pattern-matching.html