-
Notifications
You must be signed in to change notification settings - Fork 80
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
Specify compile-time error to specify explicit priorities in const entries #1259
Specify compile-time error to specify explicit priorities in const entries #1259
Conversation
I would argue that this change could be considered a clarification in the spec, not a change, but in truth a strict reading of the earlier version of the spec could easily be interpreted to imply that it was allowed to specify explicit priority values within The open source p4c implementation gives a compile-time error if you attempt to specify priorities explicitly within |
@jnfoster @jonathan-dilorenzo If there is room on the schedule for the next P4 LDWG meeting, I would like to talk about this PR. @thantry Please review this to see if it meets with your approval, and/or forward to others you would like to review it. The intent is to simply say explicitly in the language spec that when you declare The main benefit of having this change in the spec is that it simplifies the implementation a little bit, not to have to deal with |
Additional details, if you are curious: This simplification also helps simplify the P4Runtime API specification additions required in order to support initial entries [1], i.e |
One consideration where we might want to allow explicit priorities for const entries is when combined with for loops. This would let you write e.g. one loop for odd priority entries with common structure and another for even priority entries with different common structure. @thantry, do you know if there's some use-case like this? Otherwise, specifying the relevant compile-time error seems like an excellent choice! |
Not that I’m aware of. Maybe in the switch world?ThanksHariSent from my iPhoneOn Aug 7, 2023, at 2:19 PM, Jonathan DiLorenzo ***@***.***> wrote:
One consideration where we might want to allow explicit priorities for const entries is when combined with for loops. This would let you write e.g. one loop for odd priority entries with common structure and another for even priority entries with different common structure.
@thantry, do you know if there's some use-case like this?
Otherwise, specifying the relevant compile-time error seems like an excellent choice!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@jonathan-dilorenzo I am fine either way on the question of whether It is something that could be generalized in the future in the specification and p4c implementation, of course, but at least p4c right now does not allow it. |
Sounds good! Thanks for the due diligence Andy. Let's stick with this for now and then we can revisit if we have a use-case (or if the operational semantics being worked on become much weirder or something). |
Can we have a Changelog for this one? |
As discussed at the 2023-Aug-28 language design work group meeting, I will close this PR, allowing the possibility that a future version of p4c will support specifying priority values explicitly inside of a list of entries in |
Closing for reasons mentioned in previous comment. |
No description provided.