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

Change code example for sec-type-variable-operations #1345

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions p4-16/spec/P4-16-spec.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4973,21 +4973,19 @@ bool b2 = x == y; // no cast needed
[#sec-type-variable-operations]
=== Operations on types that are type variables

Because functions, methods, control, and parsers can be generic,
Because functions and methods can be generic,
they offer the possibility of declaring values with types that
are type variables:

[source,p4]
----
control C<T>() {
apply {
T x; // the type of x is T, a type variable
}
void f<T>() {
T x; // the type of x is T, a type variable
}
----

The type of such objects is not known until the control is
instantiated with specific type arguments.
The type of such objects is not known until the function is
specialized with specific type arguments.

Currently the only operations that are available for such values are
assignment (explicit through `=`, or implicit, through argument passing).
Expand Down