A variant type stores one value selected from a specified set of alternative datatypes. In a book catalogue, AttributeValue can hold an int, string, or one of several enumeration types, giving every attribute-map entry a common value type. section 2.3.4
The design uses the variant to keep attribute changes localized:
- Type indexes let the Attributes constructor verify that each key receives the correct datatype. section 2.3.4
- Matching compares complete key–value pairs while allowing missing target attributes to act as don't-care fields. section 2.3.4
Book attributes
An AttributeMap can contain {KIND: fiction, TITLE: 'Carrie', YEAR: 1974, GENRE: horror}; the same map supports strings, integers, and enumeration values without separate map types.
