|(require xiden/message)||package: xiden|
A message is an instance of the $message prefab structure used to share information in the Xiden runtime, in logs, and between processes. When the term “message” is ambiguous, then Xiden message applies the context of this section.
Message types may form a heirarchy using colon-separated identifiers that start with $. The $message type itself has no semantics beyond serving as the root type, and its identifier does not appear in other structure type identifiers. For example, identifiers pertaining to command line messages start with $cli, not $message:cli.
The type heirarchy serves only to organize statements under a given topic. Meaning that a $transfer:budget? would capture messages pertaining to a budget for a byte transfer, but an instance of $transfer:budget:exceeded is an exact statement reporting an overrun.
A message may require another message to serve as context. A type heirarchy is unhelpful for this purpose, since $transfer:budget:exceeded could apply to a download in the context of a build process or a verification process. It is difficult to define a single type to capture this kind of variation, so Xiden instead composes messages into machine-readable documents.
The second form allows declaration of a supertype, but that supertype must be a subtype of $message.
(define+provide-message id form ...)
m : $message? scope : (listof $message?) = (get-message-scope)
(in-message-scope m body ...)