liveBook · Manning

Enum

As explained in Building User-Friendly DSLs

An enumeration is a language construct that defines a fixed collection of permitted named values.

An enumeration is a fixed collection of textual values. In an MPS DSL, it is defined as an item in the structure aspect alongside concepts, interfaces, and constrained string datatypes. section 15.4.2

Type enumeration

The Type enumeration defines the permitted types in the example DSL: amount, date range, and percentage. These named values provide a fixed vocabulary for DSL content. section 15.4.2

Figure 15.7 The MPS definitions for the Record Type and Attribute concepts, and the definition for the Type enumeration
figure

Use the definition view to inspect the Type enumeration alongside the Record Type and Attribute concepts. section 15.4.2

How Building User-Friendly DSLs covers it

How deep it goes
Defines the construct and gives one concrete value set, but does not detail declaration or code-generation mechanics.
Examples
Uses the Type enumeration with amount, date range, and percentage values.
What you can do after
Evaluate fixed DSL value categories using a concrete enumeration definition.
How it connects
Connects to DSL metamodels, structure aspects, concepts, interfaces, and constrained string datatypes.

Also explained in

Compare how 23 books explain enum →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building User-Friendly DSLs. The section links point to the parts of the book it draws on.