Skip to content
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
14 changes: 8 additions & 6 deletions p4-16/spec/P4-16-spec.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1680,12 +1680,14 @@ void g()
A parameter that is annotated with the `@optional` annotation is
optional: the user may omit the value for that parameter in an
invocation. Optional parameters can only appear for arguments of:
packages, parser types, control types, extern functions, extern methods, and extern object
constructors. Optional parameters cannot have default values. If a
procedure-like construct has both optional parameters and default values then it
can only be called using named arguments. It is recommended, but not
mandatory, for all optional parameters to be at the end of a parameter
list.
packages, parser types, control types, extern functions, extern methods, and
extern object constructors. Note that optional parameters are not allowed in
parser declarations and control declarations. Allowing optional parameters in
abstract methods is deprecated, and is planned to be disallowed in the future.
Optional parameters cannot have default values. If a procedure-like construct
has both optional parameters and default values then it can only be called
using named arguments. It is recommended, but not mandatory, for all optional
parameters to be at the end of a parameter list.

The implementation of such objects is not expressed in P4, so the
meaning and implementation of optional parameters should be specified
Expand Down
Loading