BlockML Documentation

Expressions

Extended JSON inside dollar-brace delimiters

The BML expression language is extended JSON written inside dollar-brace delimiters, appearing wherever a member value needs to be dynamic — derived, computed, or bound to a service.

What an expression can reference

#this is the magic bean of the outer Block instance and the one lookup that works everywhere — a bare property name such as size is shorthand for #this.size, and the binding does not change inside nested compositions.

Built-in calls such as #math.min(a, b) reach a Capability on a built-in service Block — one of the four additions the expression language layers on top of an ordinary JSON subset.

Interpolation holes inside Text

A member value that is entirely one dollar-brace expression classifies as a full expression, while a Text value that only contains one or more dollar-brace holes among ordinary characters classifies as interpolated text under a restricted grammar profile — distinct classifications on the same delimiter syntax.

A property referencing another property

A Property's value can be a whole expression that reads another property on the same Block instance, written as a bare property name inside dollar-brace delimiters.

<!-- height's value is a whole expression that reads width by name -->
<acme:Box xmlns="http://blockml.org/bml"
  xmlns:acme="com.acme.example"
  xmlns:core="org.blockml.bml.core"
  xmlns:type="org.blockml.bml.type">

  <baseType>
    core:Block
  </baseType>
  <properties>
    <width type="type:Integer">
      <value>4</value>
    </width>
    <height type="type:Integer">
      <value>${ width }</value>
    </height>
  </properties>
</acme:Box>

width's value, 4, is a plain literal, while height's value, ${ width }, is a whole expression. The bare name width inside that expression is shorthand for #this.width — the same Box instance width belongs to — so height always tracks whatever width currently holds.

What to carry into the next pages

After this page, readers should be able to recognize an expression and know its evaluation context, before Value Configuration shows the related but orthogonal curly-brace instance configuration syntax.

Continue with value configuration