Last active
December 24, 2015 17:29
-
-
Save lptr/6836137 to your computer and use it in GitHub Desktop.
This file contains 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
class Test { | |
static var stringThing = func(String, "Hello"); | |
static var intThing = func(Int, 12); | |
static var floatThing = func(Float, 1.2); | |
static function func<T>(type:Class<T>, value:T):String | |
{ | |
return Type.getClassName(type) + ":" + Std.string(value); | |
} | |
public static function main() { | |
trace("The string thing is: " + stringThing); | |
trace("The int thing is: " + intThing); | |
trace("The float thing is: " + floatThing); | |
} | |
} |
This file contains 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
$ haxe -js test.js Test.hx | |
./Test.hx:2: characters 28-31 : #Int should be Class<Unknown<0>> | |
./Test.hx:2: characters 28-31 : { } should be Class<Unknown<0>> | |
./Test.hx:2: characters 28-31 : For function argument 'clazz' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment