BlockML Documentation

Member Inheritance and Overrides

Declaring intent to redefine a member

override="true" confirms that a local member redeclaration is a deliberate redefinition of an inherited member — required whenever a redeclaration merges with a member from the baseType chain or from contracts.

new versus override

A member declared for the first time introduces a new member and must not set override="true"; setting it without a matching parent member fails validation.

Each redeclaration layer must set override="true" again, since override is never inherited from a prior layer — a grandchild refining the same member once more restates the flag itself.

Refining versus finalizing an abstract member

A locally concrete redeclaration with override="true" satisfies an inherited abstract obligation once it is complete for its member kind; to keep the member abstract further down the chain, the redeclaration must explicitly restate abstract="true" as well.

Implementing an abstract member

A parent Block can leave a Capability abstract, declaring only its shape; a child Block completes it with override="true" and a full implementation.

<!-- Parent: "describe" is abstract — its shape is declared, with no implementation -->
<acme:Widget xmlns="http://blockml.org/bml"
  xmlns:acme="com.acme.example"
  xmlns:core="org.blockml.bml.core"
  xmlns:cap="org.blockml.bml.capability"
  xmlns:type="org.blockml.bml.type">

  <baseType>
    core:Block
  </baseType>
  <capabilities>
    <describe type="cap:Outbound" outputType="type:Text" abstract="true" />
  </capabilities>
</acme:Widget>

<!-- Child: completes "describe" with override="true" and a real implementation -->
<acme:Label xmlns="http://blockml.org/bml"
  xmlns:acme="com.acme.example"
  xmlns:lang="org.blockml.bml.language">

  <baseType>
    acme:Widget
  </baseType>
  <capabilities>
    <describe override="true">
      <implementation language="lang:PseudoCode">
        return #this.caption
      </implementation>
    </describe>
  </capabilities>
</acme:Label>

Label's describe completes exactly the obligation Widget's abstract declaration created — without override="true" here, the validator would not accept this as a deliberate redefinition of that member. Because Label's redeclaration does not restate abstract="true", describe becomes concrete from Label downward.

What to carry into the next pages

After this page, readers should know when a local member redeclaration must set override="true", before Visibility introduces the naming convention that governs access to any member.

Continue with visibility