Say I just want a template to "generate" a type, from a generic argument, and use the template's invocation in places where a type is expected:
template p[T] = T
var a: p[int]()
(3, 14) Error: expression 'T' is of type 'type int' and has to be discarded
lol, really ?
I hope I'm just being a newbie and there is indeed a way (hopefully uncontrived) to do that.
Note that it's the same output, with a non generic attempt:
template p(t: typedesc) = t
var a: p(int)
EDIT: reading this insightful answer, I realized the system might feel more patted on the back if we specified the templates's return type; adding : untyped
before = t
got the previous snippets to build. any explanation ?