Overview of Haxe code snippets, examples and tutorials tagged with static extension.
Jan 23, 2018 Beginner / Using static extensions
The concept of static extensions is a very poweful concept that gives the possibility of keeping types and objects lightweight, and extending them with functionality only when actually needed. Here we will have a look at how some commonly used methods for basic types are implemented as extension methods, and how you can write your own.‥
Jan 23, 2018 Other / Adding static methods to existing classes
Haxe allows you to add static methods to existing classes (eg. Math) via the static extensions feature. The secret sauce is to specify the first parameter of the extension as Class<X> where X is the class you want to add static methods to (eg. Math), and to make the method public.‥