[haXe] a haxe extern generator

Niel Drummond niel at cyanescent.co.uk
Sat Feb 17 11:19:30 CET 2007


hi all,

I have written a haxe extern generator in perl, to convert a tree of 
actionscript files to haxe externs. I know there is another one floating 
around, so here's the next attempt. This project will let you use 
Actionscript2 (-version 8) projects in haXe.

At the moment it has only been tested on AsWing trunk and Actionstep 
trunk, but the resulting haxe file compiles fine, and some features work 
very well (others don't). Unfortunately, I'm not very skilled at both 
libraries, and some of the tutorials I've found only partially work, so 
any suggestions for going forward are very welcome.

I've put the code up here, for the mo: http://yard.cyanescent.co.uk/

Some decisions I made due to the differences in haxe and actionscript:

- visibility of inherited members can conflict in haxe compared to 
actionscript, so I have excluded redefinitions of non-static members

- extending interfaces are not allowed in haxe, so I have left 
interfaces out of all externs. So far I do not get any compile problems, 
but maybe this can cause type related runtime errors?

- static members are not inherited in haxe (whereas counterintuitively 
they are in actionscript), so I have copied static declarations up the 
inheritance heirarchy.

- packages can only be declared once per extern file, so I have split 
externs into packages.

- all function parameters become optional, and I've added 4 optional 
parameters to each function, in order to fake function overloading.

There are some more issues, which I suspect arise from type problems. 
For example AsWing delegation does not work, which may be because you 
cannot pass functions as variables to Actionscript (I'm groping a bit 
for an explanation, I have to admit)...

Another problem is that actionstep does not compile every class in 
mtasc, but this can be stepped around by ignoring some classes.

Hope you have fun (if that is possible), please let me know if you have 
any suggestions.  

kind regards

- Niel Drummond



More information about the Haxe mailing list