Generic typedefs
Personnel
- [x] Owner: @mbudiu-vmw
- [x] Supporters: @jnfoster
Design
- [x] Document: See below
Implementation
- [ ]
p4-spec: - [ ]
p4c: https://github.com/p4lang/p4c/pull/2706
Process
- [ ] LDWG discussed:
- [ ] LDWG approved:
- [ ] Merged into
p4-spec: - [ ] Merged into
p4c:
=======================================
Currently a typedef can introduce a new identifier. But it cannot be used to introduce a new generic type, as in:
#define V1MODEL_VERSION 20210101
#include <v1model.p4>
typedef register<T, bit<8>> reg8<T>;
reg8<bit<12>> r(100);
I can see where this would be useful. The other thing that might be useful is defaults for type parameters. Though defaults can get hairy in some cases, especially if it is allowed to be depedent on the previous type parameter (e.g. header h<T, T1 = other<T>> {} )
In the interest of tidying up the set of active issues on the P4 specification repository, I'm marking this as "stalled" and closing it. Of course, we can always re-open it in the future if there is interest in resurrecting it.