🔧 TCL GLYPH DIFFICULTY: Adept Behavioral

The Memento

Captures and externalizes a spell's internal state so it can be restored later without violating encapsulation.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Memento
ARCANUM SCHOOL: Chronomancy // TimeWeaving
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// TCL PATTERN //
oo::class create SoulGem {
    variable state
    constructor {s} { set state $s }
    method getState {} { return $state }
}

oo::class create CyberWarlock {
    variable powerLevel
    constructor {} { set powerLevel 100 }
    method cast {} {
        set powerLevel [expr {$powerLevel - 20}]
        puts "Spell cast. Power level now $powerLevel."
    }
    method saveState {} { return [SoulGem new $powerLevel] }
    method restoreState {gem} {
        set powerLevel [$gem getState]
        puts "Time reversed. Power level restored to $powerLevel."
    }
}

set warlock [CyberWarlock new]
set snapshot [$warlock saveState]

$warlock cast
$warlock cast

$warlock restoreState $snapshot

The Memento

In the unstable realm of Tekromancy, fatal errors are inevitable. The Memento is a Chronomantic anchor, capturing the raw state of a system and preserving it in a crystalline object. When execution inevitably leads to corruption, the Warlock simply shatters the gem, rewinding state to a flawless point in time.

Runic Tags: #behavioral #memento #chronomancy #state