An attribute reference is an AST object that identifies a Data Attribute as the target of a reference. Its attribute setting holds a reference relation to the target attribute, rather than containing that attribute. This lets one attribute use another attribute’s value while preserving the containing AST tree. section 2.2
Referencing a rental price
An initial value for rental price after discount can be an Attribute Reference whose attribute setting targets rental price before discount. In the projected DSL, the target name is rendered as “the rental price before discount.” section 2.2 section 4.2.3
A usable attribute reference needs a target-aware projection and editing flow:
- Project the target’s name by following settings["attribute"].ref to the referenced Data Attribute and reading its name; style the result as a reference. section 4.2.3
- Find the containing Record Type through ancestor objects, then offer all of its attributes as drop-down choices. section 5.4
- When a user chooses a name, store a reference wrapper whose ref points to the matching attribute object. section 5.4
- Allow Attribute Reference as one of the two selectable concepts for a newly added initial value; handle an unchosen target as a placeholder state. section 6.1.2
References require checks beyond successful JavaScript execution. A missing target is an issue, and an attribute reference used as an initial value must target an attribute with the same type as its containing attribute. Ancestors provide the containing attribute; the reference provides the other attribute. section 9.3.3
Attribute Reference can also serve as an expression: it evaluates to the value held by its referenced attribute at evaluation time. Referenced Data Attributes remain outside an expression AST’s containment structure. section 11.1
Figure 2.16 Representing an initial value that is a reference
Shows the distinction between containing an Attribute Reference as an initial value and referencing the separate target attribute. section 2.2
