Codebase / Design scope

Design scope

Moth is deliberately small. The compiler is allowed to be clever only when the source model stays simple and explicit.

The central bias

Deferred implementation versus outside scope

A surface can be unimplemented for two different reasons.

Deferred implementation fits the accepted design but has not landed yet or is incomplete. The progress matrix reports whether a deferred surface works today.

Outside scope conflicts with the intended language model. It needs an explicit design change before it can be implemented.

This page explains whether a surface belongs in the language at all.

Preferred constrained mechanisms

Need

Preferred Moth mechanism

Compile-time generation

Templates, constants and builder directives

Static reuse

Generic functions and explicit trait bounds

Runtime heterogeneity

Choices

Expected failure

Error!, postfix propagation and catch

Platform integration

Builder packages, external packages and source-backed packages

Memory safety

GC baseline plus mandatory borrow validation

Mutation

Explicit exclusive access rather than implicit mutation

Ownership

Compiler-inferred transfer rather than source-visible move or lifetime syntax

Performance

Hidden compiler and backend optimisation

Static reuse

Use generic trait bounds when code should be reused statically across types.


    render type Item is DISPLAY_TEXT |item Item| -> String:
        return item.display()
    ;
    

Generic trait bounds are compile-time static reuse, not dynamic trait values.

Runtime heterogeneity

Use choices when a value should carry one of several concrete runtime shapes.


    Renderable ::
        LabelItem | value Label |,
        ButtonItem | value Button |,
    ;
    

Choices are the intended runtime heterogeneous value mechanism.

Questions to ask during design review

Related reading