✨ ARCANUM RUNE DIFFICULTY: Adept Structural

The Flyweight of Mana

Sharing intrinsic arcane state to minimize the memory footprint of massive ward arrays.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Flyweight
ARCANUM SCHOOL: Transmutation // Efficiency
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
interface ManaFlyweight
    exposes [IntrinsicState, ExtrinsicState, WardParticle, createParticle]
    imports []

# Shared state (Flyweight)
IntrinsicState : {
    color : Str,
    texture : Str
}

# Unique state
ExtrinsicState : {
    x : F64,
    y : F64,
    velocity : F64
}

WardParticle : {
    shared : IntrinsicState,
    unique : ExtrinsicState
}

sharedFireMana : IntrinsicState
sharedFireMana = { color: "Red", texture: "Flickering" }

createParticle : ExtrinsicState -> WardParticle
createParticle = \uniqueData ->
    { shared: sharedFireMana, unique: uniqueData }
Runic Tags: #fast-functional-wards #roc #flyweight