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

Misleading code example for 8.24. Operations on types that are type variables #1295

Open
jaehyun1ee opened this issue Jul 31, 2024 · 1 comment

Comments

@jaehyun1ee
Copy link
Contributor

Below is the code example from spec section 8.24 explaining the operations on types that are type variables.
A local variable x of type T is defined inside the apply block of a control declaration.

control C<T>() {
    apply {
        T x;  // the type of x is T, a type variable
    }
}

However, section 14 on control block mentions that,

Unlike control type declarations, control declarations may not be generic

So the above example is an invalid P4 program where C is a generic control declaration (not a control type declaration).
I believe below example would be more appropriate for the purpose.

void f<T>() {
   T x; // the type of x is T, a type variable
}
@vlstill
Copy link
Contributor

vlstill commented Sep 15, 2024

I agree the example is invalid and the sentence above it should not mention controls and parsers. Can you please open PR with the change?

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

No branches or pull requests

2 participants