component
A named participant in a protocol: something that sends and receives messages. The declaration is the name and nothing else, and protocol statements refer to it.
component Radar;
component CommandPost;Names
A component name is a global declaration — unique within its file, and importable by another module.
- A component carries no fields, no state, and no behavior. What it does is written in the protocols that name it.
- Every position that names a participant has to resolve to a
component: aconnectionendpoint, thein Cof a local protocol, thefrom/toof a connection clause, thein Cof achoiceor aninblock. - Nothing declares a participant implicitly. A component that appears only in a
sendis an unresolved name, not a component brought into being by the statement.
component Radar;
component CommandPost;
message struct TrackReport {
track_id: uint32;
}
connection TrackFeed from Radar to CommandPost;
local protocol Sweep in Radar {
send any TrackReport to CommandPost on TrackFeed;
}Errors
Naming a component that was never declared
component Radar;
message struct TrackReport {
track_id: uint32;
}
local protocol Sweep in Radar {
send any TrackReport to GroundStation; // error: unresolved-reference
}Declaring the same component twice
component Radar;
component Radar; // error: duplicate-declaration-nameRelated
- connection — the channel two components exchange messages over.
- local protocol — the behavior one component runs.
- system — one protocol per component, grouped for checking.
- group — a named boundary around components, and around other groups.