haXe/PHP
haXe/PHP is an extended version of the haXe compiler with a new platform target: PHP of course.
Why haXe/PHP? One of the biggest concerns in using haXe as a language for the server-side development is that you probably must install new software on the web-server (Apache mod_neko or some kind of JavaScript engine). This is not an option on many “cheap” (and not so cheap) hosting services while PHP is almost globally available.
Download
haXe/PHP v.1.19 CVS (2008-04-25) Alpha 2
- Mac OS X (universal DMG)
The files contain a full haXe installation with the standard libraries modified to work with PHP. It does not contain Neko and the documentation.
Windows Installation
Unzip in a folder of choice and execute haxesetup.exe. To revert to the standard haXe installation, locate the original installation folder and execute the haxesetup.exe from there.
Mac OS X Installation
Run the downloaded installer and enjoy. This version also contains the documentation.
Source Code
The zip below contains the OCaml files needed to build haXe/PHP and its standard library.
SVN
You can grab the source code here: http://caffeine-hx.googlecode.com/svn/trunk/
Known Limitations
important parts of the std library to implement:SPOD,Remoting,haxe.Template- Input/Output will be not implemented because they will probably change a lot with haXe 2.0.
php.Webis still incompleteStringandArrayare used as native values and are not encapsulated in objects. This makes the PHP code prettier and faster but as a drawback you can encounter inconveniences when those types are used as Dynamic (ex: Reflection).resources are not implementedfunction can't have the same name of the containing class (case insensitive). The problem is that PHP interprets that as a constructor.- Some constructs will not work properly:
a[b].c();a.b()[c];(new MyClass).execute();
Untested Features
Typedef extensions for ObjectsTypedef extensions for Classesa.b().c()_ _resolve_ _setfieldinternal redefine function:f() { this.f = function() { }; return this.f();
To do list
High Priority
Std.string must output nicer valuescheck if properties with full accessors are created as var; if so, removebuild equivalent classes to the neko onestest Reflection with Anonymous objects_ _break_ _is not used properlybreak does not compile in while loops- Resolve the Known Limitations where possible
- Fix bugs!
Optional
- Debug version (similar to JS -debug) + haxe.Stack
- better error handling
- nicer PHP output (strip unnecessary {}, better indentation, docs ? …)
- _ _set/_ _get/_ _call must be marked as reserved words when used in Dynamic
- implementing autoload for class files
Discussion