BlockML Documentation

Types and Values

What a type describes versus what a value holds

A ValueType describes the nature of possible values; a Property holds one actual value of that nature — the type never stores data, and every concrete value lives exclusively on the Property.

ValueType at the top of the value hierarchy

ValueType sits at the top of the value assignability hierarchy — every PrimitiveType, StructType, EnumType, and ConstantType is assignable to it, which is why only ValueTypes may appear as a Property type or a Capability input or output type.

Every Property is Optional

Every Property behaves as Optional — it has a value or it has none — because the ValueType only describes what a value could be, and there is no null state for a type that never itself stores anything.

One ValueType, two Properties

Two properties of the same ValueType can hold entirely different states — one with a value present, one with none — because the type itself carries nothing.

<!-- Both properties share the type Integer; only "count" carries a value -->
<acme:Basket 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>
    <count type="type:Integer">
      <value>3</value>
    </count>
    <reorderThreshold type="type:Integer" />
  </properties>
</acme:Basket>

count and reorderThreshold are both typed Integer, yet count carries a value, 3, while reorderThreshold carries none. reorderThreshold is simply absent — Integer, the type, never held anything either way, so there is nothing to represent as null.

What to carry into the next pages

After this page, readers should keep type and value apart when reading any member declaration, before generic type parameters extend that same type vocabulary on the next page.

Continue with generic types