|
|
|
|
|
by Klathmon
3573 days ago
|
|
I don't want to derail this whole submission talking about haxe, but this is the first time I've really ever looked at it. It's not like haxe is some kind of crazy offshoot language, it looks pretty damn close to typescript and flow (But to me this looks closer to "regular javascript" than most typescript and flow does). With the exception of the `@:expose` and `@:keep` stuff, there isn't anything i've seen yet just browsing through the source that I don't understand (as a javascript developer), and i've never seen the language before in my life. |
|
In many cases, compiler metadata is specific to a given target. E.g., they can be quite common on extern definitions. This allows the Haxe language to stay small, while providing flexibility for better target interoperability.
In this case, @:expose will expose certain methods to the global namespace, and @:keep will prevent the compiler from removing code with its dead code elimination functionality. Both of these are very useful for creating and maintaining js libraries, regardless of whether or not the library is also cross-platform.