A data record variant exists only for a value carrying fields of its own
Where a data record's fields depend on the values of some of its own fields, the data record names those fields as choosing its variant. A value that brings fields of its own has a data record variant: a data record node in the part of the specification declaring that value — a domain, or contracts — which refines the data record, names the values it answers to and declares those fields. A value that brings none has no variant, and a data record holding it holds only the data record's own fields.
A variant holding nothing says nothing the declaration of its value does not, so it would be a second copy of that declaration. A variant is held by the part of the specification declaring its value, so that part adds a variant without changing the data record or the variants another part holds.
The links it makes
The links made to it
The decisions taken on it
- Problem
Every value choosing a data record's form had a form, so a value carrying nothing got a form holding nothing; and form, a general word, named both a data record's shape and what a user fills in on a page.
- Ruling
The owner: a value carrying no field of its own has no form, which was a crutch; and the data record's form is named data record variant, a form staying what a user fills in.
- Problem
Nothing limited a data record to one field of type variant, and with two it is left unsaid which of them holds the fields of the chosen variant.
- Ruling
The owner: a data record holds at most one field of type variant, which its schema checks. Fields that do not depend on the variant are the data record's own, or the fields its field of type variant holds whatever the variant; two independent choices are two data records, each choosing its own variant.
- Problem
A data record in contracts may name fields choosing its variant, and a value its field's own list declares is then declared in contracts, which is not a domain, so no variant could stand where this rule placed it.
- Ruling
The owner: a variant stands in the part of the specification declaring its value, a domain or contracts, as the tools already held it.