Skip to content

Instantly share code, notes, and snippets.

@lptr
Last active December 24, 2015 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lptr/6836137 to your computer and use it in GitHub Desktop.
Save lptr/6836137 to your computer and use it in GitHub Desktop.
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);
}
}
$ 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