liveBook · Manning

Value kind

As explained in Building User-Friendly DSLs

A property indicating whether an attribute value is initially assigned or computed from an expression.

Value kind records whether an Attribute value is assigned initially or computed from an expression. It makes the distinction explicit because an Attribute Reference can represent either case. section 11.1.1

The property supports two choices and corresponding Domain IDE behavior:

  • initially assigns a value during runtime initialization; this is the default for migrated attributes and newly added values. section 11.1.1 section 11.2
  • computed as marks a value as derived from an expression, such as the rental price after discount. section 11.2
  • The Domain IDE exposes both choices through a dropdown and initializes value kind to initially when the user adds a value. section 11.2

Migrating and editing an Attribute

An AST migration renames Data Attribute to Attribute, changes initial value to value, and sets value kind to initially. In the Domain IDE, a user can then change rental price after discount to computed as and construct its expression. section 11.1.1 section 11.2

Listing 11.1 The addition to the AST migration to set value kind
// ...other existing code... 
if (value.concept === "Data Attribute") { 
    value.concept = "Attribute" 
    settings["value"] = settings["initial value"] 
    delete settings["initial value"] 
    settings["value kind"] = "initially"      #1
} 
// ...other existing code...

The migration explicitly assigns initially after moving the old initial value into the renamed value property. section 11.1.1

<span className="keyword ws-right">initially</span>

The keyword initially is the visible default value-kind choice in the projection. section 11.2

How Building User-Friendly DSLs covers it

How deep it goes
Defines two choices and implements migration and projection behavior, but defers effects on generated code.
Examples
Uses migrated Attributes, the rental price after discount, dropdown choices, and newly added values as concrete examples.
What it assumes
Assumes familiarity with Attributes, expressions, AST settings, and the existing Domain IDE while clarifying the new value-kind distinction.
What you can do after
Operate/configure the Domain IDE and migration scripts to set, edit, and test Attribute value kinds.
How it connects
Connects Attributes with expressions, Attribute References, AST migration, the Domain IDE, Binary Operations, and code generation.

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.