p4-spec
p4-spec copied to clipboard
Feature request: Allow don't care `_` as default argument for out arguments
Personnel
- [x] Owner: @apinski-cavium
- [x] Supporters: @mbudiu-vmw
Design
- [x] Document: See below
Implementation
- [ ]
p4-spec
: - [ ]
p4c
:
Process
- [ ] LDWG discussed:
- [ ] LDWG approved:
- [ ] Merged into
p4-spec
: - [ ] Merged into
p4c
:
=======================================
It would be a good idea to allow don't care _
as default arguments for out arguments so you don't need to specify them when doing the call.
I can see cases where it would be useful in the general sense.
An example of simple usage would be like:
void f(out bit a = _){ a = 1; }
void g(out bit b)
{
f();
f(b);
}
You could do this right now with a wrapper function:
void f(out bit a){ a = 1; }
void f(){ f(_); }
void g(out bit b)
{
f();
f(b);
}
So it just becomes a nice feature of the language.
Solved by https://github.com/p4lang/p4-spec/pull/1074
Solved by #1074
Huh? No that is a different feature request unrelated to this one.
That only just solves f(a = _);
for the call. I am asking for calls like f();
where the default argument was don't care.
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.