p4-spec
p4-spec copied to clipboard
Disallow overloading of parsers, controls, packages
Personnel
- [x] Owner: @mbudiu-vmw
- [x] Supporters: @apinski-cavium
Design
- [x] Document: See below
Implementation
- [ ]
p4-spec: - [ ]
p4c:
Process
- [ ] LDWG discussed:
- [ ] LDWG approved:
- [ ] Merged into
p4-spec: - [ ] Merged into
p4c:
=======================================
See https://github.com/p4lang/p4-spec/pull/1078 Overloading is subtle, since it can be made based on both constructor and apply arguments.
Consider this example from @apinski-cavium
Take:
parser p() () {
state start {
transition accept;
}
}
parser p() (bit a) {
state start {
transition accept;
}
}
parser p(bool b) (bit a) {
state start {
transition accept;
}
}
parser p(bool a) () {
state start {
transition accept;
}
}
parser p1() () {
p() a;
state start {
a.apply();
transition accept;
}
}
Closing as it seems this has been resolved in #1078.