« Page 3 / 14 »

  1. Haxe tips: everything is an expression

    Sun 14 October 2012

    In Haxe, nearly everything is an expression. (Things that aren’t: import statement, class declaration etc, which are at module level). And every expression can be evaluated to a value.

    A block is an expression that is evaluated to the last expression inside the block:

    var v = {
        //some code
        123 …
    continue reading
  2. Haxe tips: advanced method overloading with macros

    Fri 13 July 2012

    The @:overload metadata

    Introduced in Haxe 2.08(released in 2011), @:overload metadata can be used to annotate a method to have several type signatures. For example, in JQuery of jQueryExtern, the method “html” has the following declaration:

    @:overload(function(valueOrFunction:Dynamic):JQuery{})
    public function html():String;
    

    It declares the …

    continue reading
  3. Haxe tips: better untyped expression

    Sun 08 July 2012

    tl;dr

    Remember to put the brackets

        (untyped new JQuery("#images").imageLoader)({});
    //  ^                                         ^
    //  |________these____________________________|
    

    Abstract

    Static type system of Haxe helps you a lot by performing type-checking in the compilation phase. You will be notified errors before the application is run.

    Since some Haxe targets (e.g.. JS and PHP) are …

    continue reading

« Page 3 / 14 »