Objects
Objects, familiar but slightly different.
Declarative data formats and languages are represented as DAGs (Directed Acyclic Graphs). Stof is no different, and just like JSON, uses the term "object" to denote DAG relationships between groupings of data.
Unlike other data formats, Stof operates on itself from within itself. Therefore, we have a familiar "self" concept, referencing the object we are currently operating within, following typical lexical scoping rules. Stof also has a "super" concept for referencing an object's parent if it exists.
Additional Roots
Also unlike other data formats, Stof can have multiple root objects. Additional roots in Stof are defined with the "root" keyword where a type would go otherwise.
Paths
Everything in Stof is referenced via paths: fields, objects, and functions. Paths are dot-separated, with each token of the path referencing an object name until the last token, which can be an object, field, or function.
Stof's path resolution algorithm looks at children first, then the parent, then itself, and then any fields pointing to other objects. If an object does not have a parent (root), then it will look for other roots with that name. The keyword "super" matches with any parent name, and the keyword "self" matches with any object name when matching with itself.
The result is being able to reference data and objects in specific locations from anywhere in the document at all times.
Children
Parents
Self
Other Roots
Root objects look at other root object names in place of a parent.
Absolute Paths
Instead of using "self" or "super", you can always use absolute paths from a root node to point anywhere in the document. The default root object is named "root".
Last updated