Haxe Code Cookbook

static extension

Overview of Haxe code snippets, examples and tutorials tagged with static extension.

  • Jan 03, 2017 Beginner /

     static-extension modules

    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 03, 2017 Other /

     static-extension

    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.‥