May 2021
Mo Tu We Th Fr Sa Su
<< >>


Haxe Improves

Posted on Jan 30 2006

I did a lot of changes and improvements to Haxe this Week End.

The typer was greatly improved. I fixed some minor issues and I added some lazy type checking so for example when a method is used for the first time, its body is first inferred before we start unifying the arguments. This is really more powerful since you don't have to type arguments and return types of your methods so much, they'll still be strictly type checked. In previous cases for example unification was done even if the method was not yet type checked, and later the unified arguments types where used to type check the method body. That was more error-prone since correct methods could fail because of previous erroneous usage. This is now fixed.

Also, a lot of changes have been made in order to ease Haxe usage. The upcoming beta 1 release is focused on maximizing easability. For example, Haxe will come with a small Neko Web Server that can be run locally to develop websites, so you don't have to install and configure Apache (you might still need to install MySQL if you don't have an accessible database).

Also, on Windows, a small executable called haxesetup will be part of the distribution. It will setup the PATH environment variable correctly and register the .hxml files to be run with the haxe commandline compiler.

The HXML format is just a list of Haxe parameters in a text file (one parameter or class name with optional argument per line). Here's an HXML example :

-neko test.n
-main TestServer.hx
-swf test.swf
-main TestClient.swf

Running the HXML is the equivalent of calling the following command :

haxe -prompt -neko test.n -main TestServer.hx --next -swf \
    test.swf -main TestClient.swf

The user simply doubleclick on the HXML file to run it. If an error occurs and -prompt was set, then the Haxe compiler will wait for Enter before exiting. This way the errors are displayed in the newly opened Windows Console. In that example, it will compile the server and the client (--next separates two Haxe batches, like if Haxe was called two times).

So what ? You could think that it looks like a poor Makefile system. True. It's nothing fancy, but it's just a good and easy way to enable Windows users to use Haxe without opening an IDE or the commandline, and it doesn't prevent using the Haxe compiler directly from the commandline.

  • Steve Day
    Nov 10, 2010 at 18:52

    Hey Nicolas what about the -cp param... I am trying to make haxe create an swf file from an .hx file in a different directory to the compiler: so I tried this:
    haxe -swf D:\Projects\haxe\BlueCircleMove.swf -swf-version 9 -main D:\Projects\Haxe\BlueCircleMove -swf-header 300:300:60:66FFFF

    and i get error "invalid class name", I saw somewhere reference to a -cp directive that would allow you to compile an .hx file from a remote directory....can you commentt...?

    Best Wishes


  • Steve Day
    Nov 10, 2010 at 19:02

    Wow Ive done it so for anybody elses info too the answer is the -cp param followed by the -main filename like this:

    haxe -prompt -swf D:\Projects\haxe\BlueCircleMove.swf -swf-version 9 -cp D:\Projects\haxe\ -main BlueCircleMove -swf-header 300:300:60:66FFFF

    And it works...:-)


Name : Email : Website : Message :