As Adama is a data-centric programming language, the core game to play is organizing your data for state management. At the document level, state is laid out as a series of fields. For instance, the below Adama code outlines three fields:
public string output; private double balance; int count;
These three fields will establish a persistent document in JSON:
The public and private modifiers control what users will see, and the omission of either results in private by default. In this case, users will see:
when they connect to the document.
The syntax which Adama parses for this is as follows:
(privacy)? type name (= expression)?;
- privacy when set may be private, public, or anything outlined in the privacy section. In this context, private means only the system and code within Adama can see the field while public means the system, the code, and any human viewer may see the field. The privacy section will outline other ways for humans to see the field. When privacy is omitted results in a default value of private which means no users can see the field.
- type is the type of the data. See types for more details.
- expression when provided will be computed at the construction of the document.