Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P4_16: Named parameters #598

Closed
cc10512 opened this issue Mar 25, 2018 · 2 comments
Closed

P4_16: Named parameters #598

cc10512 opened this issue Mar 25, 2018 · 2 comments

Comments

@cc10512
Copy link
Contributor

cc10512 commented Mar 25, 2018

No description provided.

@cc10512 cc10512 self-assigned this Mar 25, 2018
cc10512 pushed a commit to cc10512/p4-spec that referenced this issue Mar 25, 2018
@jafingerhut
Copy link
Collaborator

@cc10512 One thing that confuses me about the idea as described on the wiki here: https://github.com/p4lang/p4-spec/wiki/Named-Parameters

I think you have said that the proposal is only to allow named parameters for compile-time parameters, e.g. compile-time parameters for controls and parsers, package instantiations, and extern constructor calls. That makes sense to me.

But one of the examples on the wiki is for the parameters resubmit_meta and recirculate_meta of the PSA IngressParser to be named, with a default value. Those are run-time parameters to the parser, aren't they?

If you allow those run-time parameters to have default values, what criteria would you propose to distinguish the cases where run-time parameters can have default values, vs. those that cannot?

If you do allow cases where run-time parameters can have a default value of _ as shown in your wiki example, what should happen if that parameter is accessed in the body of the control/parser? Should that be an error? If it isn't an error, what value should that parameter have at run-time if it is not supplied in the call to the parser/control at run time?

@mihaibudiu
Copy link
Contributor

We should allow calls to use named parameters everywhere.
We should only allow default values or optional parameters in some kinds of declarations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants