-
Notifications
You must be signed in to change notification settings - Fork 82
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
[#1362] Clarify that switch
statements _are_ allowed in action/function bodies, and that switch
statements with action_run
expressions are only allowed in control apply
blocks
#1363
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: kfcripps <[email protected]>
So this does work in the P4C, right? |
@vlstill For backends that don't run the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for the clarifications.
This type of `switch` statement can only be used within control `apply` | ||
blocks. For this variant of `switch` statement, the expression must be | ||
of the form `t.apply().action_run`, where `t` is the name of a table | ||
(see <<sec-invoke-mau>>). All switch labels must be names of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this implicit from the fact that table.apply()
can only be used in control apply blocks, not in functions or actions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"This type of switch
statement can only be used within control apply
blocks." is definitely implied by other parts of the spec, but it seems reasonable to say here, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't think it hurts to explicitly state that here, but if anyone strongly opposes it I can remove it.
The other clarifications are the most important parts of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Cleans up some wording that was missed by #945, which makes it unclear as to whether
switch
statements are actually supported in actions/functions or not.Closes #1362.