Haxe 2.03 has just been released on http://haxe.org

SWC Support

This new release includes some still experimental SWC output feature. SWC is the library format used by Flash. Haxe only supports SWC for Flash9+.

The idea is that a lot of people that write AS3 libraries would really love to use Haxe because of the language and its performances, but can't because their users are using AS3.

So far it was already possible to generate AS3 code from Haxe code, but at this time you were losing all Haxe compiler performances improvements. Now since SWC contains the bytecode as it was compiled by Haxe, you can write your library in Haxe and distribute the SWC for AS3 users.

Read http://haxe.org/doc/advanced/swc for more informations on SWC output.

Once we are sure it works well, I guess the next step will be to add SWC input to Haxe, so you can reuse existing AS3 libraries directly (it's currently possible to do so by using --gen-hx-classes but it has some issues as well).

More Optimizations

Haxe 2.03 also adds new optimizations, including a strong constant expression optimizer. In fact, it often happens after doing some inlining that some expressions are useless.

Takes the following example :

class Test { static inline function foo ( max,callb,flag ) { for ( i in 0... max * 3 ) callb ( flag ? i : -i ) ; } static function main ( ) { var x = 0 ; foo ( 50 , function ( i ) x += i,true ) ; } }

Since we inline the function, it's the same as writing the following :

var x = 0 ; for ( i in 0...50 * 3 ) ( function ( i ) x += i ) ( true ? i : -i ) ;

With new Haxe constant expression optimizer, it will reduce the expression to the following :

var x = 0 ; for ( i in 0...150 ) x += i;

The constant expression optimizer can handle the following patterns :