p4lang / p4-spec

Apache License 2.0
178 stars 80 forks source link

Do we allow `string` type to be aliased by `typedef`? #1293

Closed jaehyun1ee closed 3 months ago

jaehyun1ee commented 4 months ago

The section 7.2.8. Type nesting rules enumerates what type can be aliased or not by a typedef declaration.

The table below seems to omit the case for the string type. I expect that new type declaration would not allow string type, but I wonder if P4 allows it for typedef case. Checking with the p4c compiler, it currently allows string to be aliased, e.g., typedef string string_t; typechecks.

image

jafingerhut commented 4 months ago

Would you be willing to create a PR with a new row for the string type, with entries that match what p4c currently supports, so we can discuss it in a future P4 language design work group meeting? It seems reasonable to me if the spec follows what the implementation currently does, but discussion at such a meeting might lead to other conclusions.