#How to extract the parameters passed to a generic type function?

1 messages · Page 1 of 1 (latest)

dense tiger
#

you mean inside the definition of MakeType function?

#

or get the u8, i32 from MyType?

#

can use @Type builtin to find it out

#

like if MakeType returns this struct: struct{ a: u8, b: i32 }

potent lotus
#

that wouldnt be able to tell you

#

oh, like that
sure

dense tiger
#

you can use @TypeInfo(MyType).Struct.fields[0].type to get type of a

hot granite
#

@typeInfo?

dense tiger
#

oh yeah mistook the names

hot granite
#

afaik the only way is a case-by-case basis, if you define MakeType you can make the args public decls, or you can use reflection to get the type, ie the return type of a function that returns T without any wrapping, or wrapping you can undo easily

potent lotus
#

^