p4lang / p4-spec

Apache License 2.0
178 stars 80 forks source link

Clarify nesting rules #1296

Closed vlstill closed 3 months ago

vlstill commented 3 months ago

This tries to resolve #1285. If merged in the current form, it would also fix #1293 and supercede PR #1294. I tried to make the "categories"/"kinds" of types (like headers and enums) distinct from actual types -- I used for each the name that is used in its section. Furthermore, in the second table (typedef/type rules) I've added the two missing lines for string and for list types. Apparently compiler handles them as would be expected / as I added.

I've also tried to add rationale for the typedef rules. I must say I am not happy with it and I wonder if someone can get a better one. Or we may just allow it (C allows typedefing even void).

Fixes #1285.

jonathan-dilorenzo commented 3 months ago

Discussed in the P4 LDWG. @vlstill is planning to change the rationale to say roughly "We don't know of any reason to want this so we are conservatively disallowing it."

Then ready to merge.