A boolean is a value or type with two truth values: true and false. Logical expressions produce boolean values, making them suitable for controlling business-rule conditions. section 14.1.1 section 14.4
Implementing boolean support in a DSL involves:
- Registering boolean as a built-in type and rendering its type name as boolean. section 14.1.1
- Type-checking each business-rule condition and reporting an issue when it does not produce a boolean. section 14.1.1
- Requiring both the condition and consequence properties on every business rule. section 14.1.1
Boolean business-rule condition
A business rule follows the form “when <condition>, then <consequence>.” The condition must be a logical expression whose computed type is boolean; the consequence specifies a value change or other effect. section 14.4
Listing 14.1 Migration to add a business rules property
const addBusinessRulesProperty = (recordType) => {
if (!Array.isArray( #1
recordType.settings["business rules"])) {
recordType.settings["business rules"] = [] #2
}
return recordType
}
// ...run migration from v1 -> v2 if necessary...
doMigration("v2", "v3", addBusinessRulesProperty) #3
Use the built-in-type implementation as a concrete reference for registering boolean and converting its internal type representation to boolean. section 14.1.1










