The remap switch
The compiler has a remap
switch that allows us to rename a package, for example, imagine the following code:
//Some previous codemyPack.Lib.println("Hello remapping!"); //Some code following
This would obviously not work because the Lib
class is not in the myPack
package. However, if you compile with the switch --remap
myPack:neko
when compiling to Neko, this will work. The reason is simple: anywhere you have used the package name myPack
; the compiler will replace it with Neko, therefore using the correct package.
This can be used to make some cross-platform code.
On the other hand, it has a big draw-back: when you remap a package, all of the modules it contains are remapped. This actually means that you won't be able to use something ...
Get haXe 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.