Containment is a directed ownership relation from a source object to a target object. A solid arrow labeled with a property name shows that the source contains the target through that property. A target may have at most one incoming containment relation, and an object cannot contain itself. section 2.1
Treat a containment relation as a non-simple setting on its source: the property label is the setting name and the target object is its value. This restriction makes containment suitable for tree-like structure; use a dashed reference relation when an object must point to another object without owning it. section 2.1 section 2.2
Containing record attributes
A Record Type named Rental contains its Data Attribute objects through an attributes property. Each attribute can in turn contain an initial value object, such as a Number. The nested ownership mirrors the visible structure of the record definition. section 2.2
Figure 2.12 Connecting the attributes objects to the Record Type object through containment relations
This diagram shows the Rental record object connected to its attribute objects through the multivalued attributes containment property. section 2.2
In a JavaScript AST encoding, represent each contained object as a separate object and place it in the containing property’s value. A multivalued containment property uses an array, so Rental’s attributes setting holds the attribute objects; nested initial value settings hold their own contained objects. section 3.1.1 section 3.2.1
Accessing a contained object
Access the fourth contained attribute with rental.settings["attributes"][3]. The attributes setting evaluates to an array, and JavaScript array indexes start at 0, so index 3 selects position four. section 3.2.1
