group
A named set of components and other groups: an architectural boundary drawn around runnable software, not a participant in it. A group never sends, receives, or runs a protocol.
component Radar;
component Sonar;
component TrackFusion;
component CommandPost;
group Sensors {
Radar;
Sonar;
}
group CombatSystem {
Sensors;
TrackFusion;
CommandPost;
}Members
The body is a sequence of members, each a path and a ;.
- The name is a global declaration, unique in its file and importable by another module.
- A group may have zero members.
- Each member names a component or a group.
- Membership is by declaration, not by spelling. Two import aliases of one component name one member.
- A group is not a component. It cannot stand where a component is required: a
connectionendpoint, a connection clause, or thein Cof a local protocol, achoice, or aninblock. - A
systemnames local protocols, so a group cannot be asystemmember either.
module fleet::patrol.sensors
component Radar;
component Sonar;
// ────
module fleet::patrol.architecture
import fleet::patrol.sensors as s
group Sensors {
s.Radar;
s.Sonar;
}Nesting
A group inside another group draws a boundary within a boundary.
- A member belongs to at most one group. This holds across modules: two groups in two files cannot both claim one component.
- Membership is acyclic. No group contains itself, directly or through other groups.
- Groups therefore form a forest: every component and group has at most one parent group, and no cycles.
- A group need not have a parent, and a component need not belong to any group.
component Radar;
component Sonar;
component Launcher;
component GroundStation;
group Sensors {
Radar;
Sonar;
}
group Weapons {
Launcher;
}
group Ship {
Sensors;
Weapons;
}Ship contains Sensors and Weapons, each of which has one parent. GroundStation belongs to no
group.
Errors
A member that is not a component or a group
component Radar;
message struct TrackReport {
track_id: uint32;
}
group Sensors {
Radar;
TrackReport; // error: group-member-target
}A component in two groups
Every membership after the first is the error, ordered by file and then by position in the file.
component Radar;
group Sensors {
Radar;
}
group Surveillance {
Radar; // error: duplicate-group-membership
}The same member twice in one group
component Radar;
group Sensors {
Radar;
Radar; // error: duplicate-group-membership
}A group that contains itself
Every member entry on the cycle is an error, in whichever group it appears.
group Sensors {
Surveillance; // error: cyclic-group-membership
}
group Surveillance {
Sensors; // error: cyclic-group-membership
}Using a group where a component is required
component Radar;
component CommandPost;
group Sensors {
Radar;
}
connection TrackFeed from Sensors to CommandPost; // error: connection-target-not-component