Value Subset - modelint/types GitHub Wiki
When we define a Component of a Type, we may also narrow down the set of values that can be assigned.
Let's say you are defining a cell location in a grid of rows and columns as we do in the Flatland diagram generator.
Cell
Row :: Integer(1, max)
Col :: Integer(1, max)
Each of these two Components restricts the Integer Type to positive integers beginning from one. We aren't actually defining a new Type since all Integer operators still apply.
Though we could, instead, define a new User Type named Natural Number like so:
Natural Number
Value :: Integer(1, max)
And then we could redefine Cell as follows:
Cell
Row :: Natural Number
Col :: Natural Number
In the new definition of Cell we don't further constrain the Component Types.
What's the difference, then, between a Value Subset and a Type?
A Type specifies both a set of assignable values and a set of Operators, while a Value Subset is simply a subset (possibly not a proper subset) of a selected Type. In other words, a Value Subset does not specify any Operator modifications.
Identifiers
- Component + User type
Attributes
No non-referential attributes.