Haxe Code Cookbook

building fields

Overview of Haxe code snippets, examples and tutorials tagged with building fields.

  • 01-11-2016 Macros /

     expression-macro building-fields

    This macro function automatically assigns parameters of method to local variables.‥

  • 03-01-2017 Macros /

     build-function building-fields array

    Sometimes it is useful make your arrays compile-time, for example to embed data from files, to pre-calculate heavy calculations, generating lookup tables and other similar things. With macros this is perfectly doable but requires some basic knowledge of expression building. In this article you will find out how to build arrays and return them as expressions in a macro function.‥

  • 01-11-2016 Macros /

     build-macro building-fields

    This snippet demonstrates how to add a map field to a type.‥

  • 01-11-2016 Macros /

     build-macro building-fields

    Virtually adds this property to a class: public var myVar(get, null):Float; private inline function get_myVar():Float { return 1.5; }‥

  • 01-11-2016 Macros /

     build-macro building-fields

    Virtually adds this static variable to a class: public inline static var STATIC_VAR:Float = 1.5;‥

  • 01-11-2016 Macros /

     build-macro building-fields

    This example generates a constructor-function for each field of a class to easily create value object classes.‥

  • 01-11-2016 Macros /

     arguments building-fields build-macro

    Automatically generate dispatch functions as:‥