Messages and dialects
A CBCL message is an S-expression. Parentheses group a form, the first symbol names its operation, and the remaining values supply its arguments. Here is a complete opener from the lunch poll:
(lang lunch-vote
(propose @team
:question "Lunch?"
:options ("Sushi" "Pizza")
:caused-by begin
:thread "friday"
:from @alice))
The outer lang wrapper selects the installed dialect. In the inner message, propose is the verb, also called a performative. @team identifies the recipient. A keyword introduces a named field. The question is a string, and the options are a list of two strings. The final fields connect the proposal to a thread and identify the claimed sender.
How the participants agree on meaning
The receiver uses the definition of lunch-vote to interpret propose. The definition gives the expansion of the verb and the types of its fields. The protocol specifies where the verb can occur. The installer checks the definition. For example, it rejects a definition that changes a core verb.
The shape specifies a list for :options and a string for :choice. To check a choice, the runtime uses the options from the opener. The dialect expresses that relationship in its state rules. Write a poll dialect shows these clauses side by side.
What has an address?
A message’s wire address identifies structured message content. Two voters can send the same choice, “Pizza”. A causal reference identifies the message that a voter saw. The host keeps the complete canonical message. A second receiver can use it to check the reference.
Use the SDK address operation for a storage index. The canonical encoding specifies the input for the hash. The display text and a JSON representation have different encodings.
A dialect can also have a content address. The JavaScript contract builder supplies a label and a generated dialect name. The label helps people find the definition. The content address identifies its version. See How a host adopts a dialect.
Continue with Threads and causality.