Can tables be defined without an actions property?
Take:
action NoAction() {}
control c()
{
table t {
const g = 1;
}
apply {
}
}
The way I read the spec is that actions will always be defined to include NoAction is default_action is not supplied and therefore the above table is a valid table. The language from the spec:
A table must declare all possible actions that may appear within the associated lookup table or in the default action
...
The compiler must set the default_action to NoAction (and also insert it into the list of actions) for tables that do not define the default_action property. This is consistent with the semantics given in Section [14.2.1.3](https://p4.org/p4-spec/docs/P4-16-v-1.2.3.html#sec-default-action). Hence, all tables can be thought of as having a default_action property, either implicitly or explicitly.
The also insert it into the list of actions make it sound like actions is always there even if the developer does not supply it. This might be a spec issue of requiring always an actions property but I am not fully convinced that we should require it.
If such a table definition were legal, applying it would always be a no-op, i.e. execute only NoAction, true?
I cannot think of any problem with allowing such a table definition, but it doesn't add any expressive power to the language that I can see.
Oh, and for anyone curious, I tried it with latest open source p4c and p4test, and both give a compile-time error that looks like the below if you try to define a table with no actions property at all:
error: my_table: expected 'actions' property
The p4c behavior is correct. default_action is invoked on table miss. However, no action has been specified for table hit, so why should p4c accept the table?
I assume we can close this question.