BlockML Documentation

The Type System

Four sibling kinds under ValueType

BlockML knows four ValueType kinds at language level — PrimitiveType, StructType, EnumType, and ConstantType — each naming a distinct semantic meaning as a sibling branch under ValueType, not a subtype of one another.

The four kinds at a glance

Every ValueType a reader encounters classifies into exactly one of these four kinds:

  • PrimitiveType

    Atomic scalar semantics with no stored values on the type itself — Boolean, Integer, Text, and similar.

  • StructType

    Composite value objects whose shape comes from ordinary declared properties.

  • EnumType

    A closed set of named members, own branch — not a StructType and not a PrimitiveType.

  • ConstantType

    A singleton value domain — one configured literal, useful as a union alternative.

Type expressions are not a fifth kind

Multiplicity brackets, unions, generic application, and instance configuration combine named types — they are type expressions, not additional BlockML type classes beyond the four ValueType kinds.

Classifying a Property's type

A Property's type attribute always names one of the four ValueType kinds, directly or through a type expression built from it.

<!-- caption is typed with the PrimitiveType Text; position is typed with the StructType Point -->
<acme:Label 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>
    <caption type="type:Text" />
    <position type="acme:Point" />
  </properties>
</acme:Label>

caption's type, type:Text, classifies as PrimitiveType; position's type, acme:Point, classifies as StructType — the same classification exercise applies to any type a reader meets later.

What to carry into the next pages

After this page, readers should be able to name the four ValueType kinds and classify a given type among them, before each kind gets its own page in turn.

Continue with primitive types