Last active
August 29, 2015 14:21
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-js Main.js | |
-main Main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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