The remap switch

The compiler has a remap switch that allows us to rename a package, for example, imagine the following code:

//Some previous code myPack.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 that is platform-specific inside this package.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.227.82