TOC Prev Next

Expressions

Interpolation of Field Names

String interpolations may also be used in field names.

One cannot refer to generated fields with references.

genfield.cue:

sandwich: {
    type:            "Cheese"
    "has\(type)":    true
    hasButter:       true
    butterAndCheese: hasButter && hasCheese
}

$ cue eval -i genfield.cue

sandwich: {
    type:            "Cheese"
    hasButter:       true
    butterAndCheese: _|_ // reference "hasCheese" not found
    hasCheese:       true
}