The type checking for this will be done in the backend rather than the front-end.
It would be useful for these type T would be a static type (say bit<32>) which will reduce how much type checking needs to be done in the backend.
If we really want to use generics here, it would be useful to explain what types are valid in the header file. E.g say all bit<N>, int<N> types, and serializable enums. (yes it might be obvious but sometimes being explicit is makes it less ambiguous as say you have a struct which is just wrapping an bit type).
An example is at: https://github.com/p4lang/pna/blob/8fa3993a0e32959b6e394a8923e53292191d4825/examples/include/crypto-accelerator.p4#L100
void set_auth_data_offset<T>(in T offset);
The type checking for this will be done in the backend rather than the front-end. It would be useful for these type T would be a static type (say bit<32>) which will reduce how much type checking needs to be done in the backend. If we really want to use generics here, it would be useful to explain what types are valid in the header file. E.g say all type).
bit<N>
,int<N>
types, and serializable enums. (yes it might be obvious but sometimes being explicit is makes it less ambiguous as say you have a struct which is just wrapping an bit