Skip to content

Sub bodies

Benedict Albrecht edited this page May 20, 2026 · 4 revisions

Sub-bodies

Sub-bodies define where child objects can appear within a parent object, creating hierarchical nesting.


How Sub-bodies Work

graph TD
    subgraph "<--->  Default Sub-body"
        CLASS1["<b>class</b>"] <-->|"both-sided<br/>dependency"| FUNC1["<b>function</b>"]
    end

    subgraph "<-function->  Typed Sub-body"
        CLASS2["<b>class</b>"] ---|"no dependency<br/>on child"| FUNC2["<b>function</b>"]
        FUNC2 -->|"depends on<br/>parent"| CLASS2
    end

    style CLASS1 fill:#4a90d9,color:#fff
    style FUNC1 fill:#7b68ee,color:#fff
    style CLASS2 fill:#4a90d9,color:#fff
    style FUNC2 fill:#7b68ee,color:#fff
Loading

Basic Sub-body <--->

Accepts any child object. Creates a both-sided dependency between parent and child.

<*{}*> { <---> } <*>
<:class:> class <<name>> () { <---> } <:>

Typed Sub-body <-name->

Accepts only the named object type. Only the child depends on the parent — not the other way around.

<:class:> class <<name>> () { <-function-> } <:>
<:function:> function <<name>> () { <---> } <:>

This allows loosely coupled structures — e.g., functions within a class where the class doesn't depend on its functions.


Dependency Comparison

Sub-body Accepts Parent → Child Child → Parent
<---> Any object
<-name-> Named type only

Next: References — Substituting objects into other definitions.

Clone this wiki locally