Hacker News new | ask | show | jobs
by jdonaldson 3572 days ago
I'm guessing you've already looked into those keywords, but @:expose and @:keep are Haxe compiler metadata. These are tags that are used to provide additional information to the compiler. A full list is here: https://haxe.org/manual/cr-metadata.html

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.