A data type specifies what values a property may store and what those values mean. In a domain-specific language, every concept property has a type; property types also govern which instances can be related through settings. A record type, for example, groups attributes that belong to the same record. section 1.4.2 section 1.5
Types distinguish values that may share a low-level representation but carry different domain meaning. Amount and percentage attributes can both hold numbers, yet $3.0, 3.0%, and 300% are not interchangeable. A date range represents a different kind of value altogether, such as a period between two dates. section 13.0
A type system makes types useful by performing three linked jobs:
- Represent ranges of domain-specific values as type objects. section 13.0
- Compute a type for each expression from its contents and subexpressions. section 13.0
- Compare computed types in constraints and report type errors that help domain experts repair invalid expressions. section 13.0
Formatting an initial numeric value
A projection can inspect the containing Data Attribute’s type before rendering a Number. When the type is amount, it displays a $ prefix; when it is percentage, it displays a % postfix. The renderer receives the parent AST object because the Number alone does not carry that type information. section 4.2.3
Type changes are structural changes. Adding a property or concept widens the set of valid ASTs, while changing a property to an incompatible type, removing it, or refactoring related concepts can require an AST migration to make existing content conform again. section 10.3.2
Figure 13.1 An expression that doesn’t make sense due to the types of its subexpressions
Inspect an expression whose subexpressions have incompatible types, motivating computed expression types and type-error reporting. section 13.0

















