Skip to main content

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: a connection endpoint, the in C of a local protocol, the from/to of a connection clause, the in C of a choice or an in block.
  • Nothing declares a participant implicitly. A component that appears only in a send is 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-name
  • 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.