Hello, everybody.
Quick question.
Example with non-compiling code, similar to the one at
http://haxe.org/manual/type-system-generic-type-parameter-construction.html :
typedef Constructible = {
public function new():Void;
}
class Test {
public function doIt():Void {
doIt_byType<Array<String>>();
}
@:generic
private function doIt_byType<T:Constructible>():Void {
var foo:T = new T();
trace(foo);
}
}
I'm trying to call doIt_byType forcing the type parameter, because the method doesn't have any parameter and returns Void. Is there any way of doing it? I mean, without the workarounds, like passing a fake argument or returning something with the required type.
Thanks!