Skip to content

Instantly share code, notes, and snippets.

@skial
Last active August 29, 2015 14:21
Show Gist options
  • Save skial/a041c0b91cc8b0c3bb0c to your computer and use it in GitHub Desktop.
Save skial/a041c0b91cc8b0c3bb0c to your computer and use it in GitHub Desktop.
Haxe 3.2.0 @:callable example used in http://haxe.io/releases/3.2.0/
-js Main.js
-main Main
package;
@:callable abstract Function<T>(T) from T {}
class Main {
static function main() {
var a:Function<Int->Int> = function(v) return v * v;
a(31);
}
}
(function (console) { "use strict";
var Main = function() { };
Main.main = function() {
var a = function(v) {
return v * v;
};
a(31);
};
Main.main();
})(typeof console != "undefined" ? console : {log:function(){}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment