haXe, your universal Web language

125

A couple of years ago, when I was working with SE|PY for a Flash project, I discovered I could use an alternate compiler to build a Flash application – MTASC. It supported ActionScript 1 and 2, but not 3. When I read more about it, I learned that its creator, Nicolas Cannasse, was working on a new compiler (and also a language on its own), called haXe.

The thing that distinguishes haXe from the others is that it is a cross-platform language designed to build Web applications (although you can use it for other purposes). When you write your code in haXe, you use the haXe syntax and libraries – you can then compile your code into different “targets” depending on your needs. Today, haXe supports Javascript, Flash, NekoVM, PHP and C++.

I started using it very recently to develop a framework in PHP and I fell in love with it. Although the Javascript API has some shortcomings, the PHP one is pretty good. The advantage of using haXe is that if your project requires more than one technology (for example, you build a site that uses Javascript and PHP), you can write the code in one universal language, then compile your client-side and server-side packages on distinct platforms.

haXe offers a standard library, common to every target, which offers a rather large array of features, considering the amount of targets supported by the language, then target-specific libs that works only on one platform. There is also a way of making direct calls in the target language – but if you use it too much, you’ll probably run into problems.

If you do Web development, I suggest you give haXe a try – it’s very interesting and also very fun to work with. Moreover, if you worked with a language with an ECMA style (like ActionScript), you already know a bit on the haXe syntax, as it follows this style. The compiler can be installed in Linux (some distros may be providing packages, but an installer is provided and of course, the source code), Mac OS and Windows. Here are some resources: