Next: blocking
, Up: Component Declarative Statements [Contents][Index]
on
Similar to an interface, in a component the on
defines which
trigger is to be handled. Component triggers, however, belong to
a port and carry formal parameters:
on ::= ("on" triggers ":" statement) | ("on" illegal-triggers ":" illegal) triggers ::= trigger ("," trigger)* trigger ::= port-name "." event-name "(" formal-list? ")" formal-list ::= formal ("," formal)* formal ::= identifier | (identifier formal-binding) statement ::= declarative-statement | imperative-statement | illegal imperative-statement ::= action | assign | call | if | reply | return | variable | imperative-compound | defer-statement | empty-statement illegal ::= "illegal" imperative-compound ::= "{" (imperative-statement ";")* "}" defer-statement ::= "defer" argument-list? imperative-statement argument-list ::= "(" ")" | "(" expression ("," expression)* ")" empty-statement ::= illegal-triggers ::= illegal-trigger ("," illegal-trigger)* illegal-trigger ::= port-name "." event-name
The formal-list
to be used is defined by the parameters of the
event definition in the interface. Their relation is position-based.
Formal parameters may introduce another name than specified in the
event
definition in the interface.
For example:
on p.hello (greeting): w.hello (greeting); on p.cruel, r.hello: illegal; // Note this is optional since 2.14.0.
When two or more imperative statements are specified for a certain trigger, the component is said to be non-deterministic. For example:
on p.hello (): w.hello (); on p.hello (): ;
non-determinism in components is not allowed and will lead to a verification error (See Verification Checks and Errors).
The formal-binding
is a feature for blocking
and
synchronous out event contexts See Formal Binding.