Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Entities and state

An entity has a stable quoted identity and a set of components. The current DSL supports description, capacities, properties, traits, and conditions.

entity "van-110" {
    description {
        name = "White VW van"
        plate = "ABC-123"
    }

    capacities {
        payload_mass = 800 kg
    }

    properties {
        payload_mass = 0 kg
        speed = 70 km/h
        located_at = location(59.3293, 18.0686)
    }

    traits [vehicle van diesel]

    conditions {
        readiness = ready
    }
}

Description

description contains named string values. It holds human-readable metadata, not changing operational state.

description {
    name = "White VW van"
    plate = "ABC-123"
}

Properties

properties contains current state values. The resolver accepts three value forms:

  • a quantity such as 120 kg;
  • a location such as location(59.3293, 18.0686); or
  • a reference to one component value on an entity or mutation role.
properties {
    mass = 120 kg
    located_at = location(59.3293, 18.0686)
    depot = @"hq".properties.located_at
}

Plain numbers, strings, symbols, arithmetic expressions, and arbitrary function calls are not valid property initializers. location takes exactly two signed or unsigned numbers. The resolver does not currently check geographic ranges.

Capacities

A capacity is a limit for a property on the same entity. Every capacity must have a property with the same name.

capacities {
    payload_mass = 800 kg
}

properties {
    payload_mass = 0 kg
}

When both values are concrete, they must use the same broad value form: quantity with quantity, or location with location. The current check does not compare quantity units or evaluate bounds. A reference value bypasses this shallow compatibility check because its concrete type is not resolved yet.

Traits

Traits are identifier labels that state a capability or classification.

traits [vehicle van diesel]

A trait path names one specific trait:

@"van-110".traits.vehicle

Conditions

conditions contains named state expressions. See Conditions for declarations and current validation limits.

Component names

A component entry name must be unique within its component kind, including across repeated sections. A reference to a known entity must name an entry that the entity declares.