Proxy (Forth)
Guard the deep invocations with conditional gateways.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Proxy
ARCANUM SCHOOL: Abjuration // Gatekeeping
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FORTH PATTERN //
\ Gatekeeping: The Proxy
\ Protecting or deferring expensive/dangerous operations.
VARIABLE MANA-POOL
10 MANA-POOL !
: REAL-DOOMSDAY ( -- )
." THE HEAVENS TEAR APART!" CR ;
\ The Proxy
: CAST-DOOMSDAY ( -- )
MANA-POOL @ 100 < IF
." FIZZLE: Not enough mana for Doomsday." CR
ELSE
REAL-DOOMSDAY
THEN ;
\ Usage:
\ CAST-DOOMSDAY
Some spells are too destructive to run unchecked. The Proxy acts as an intermediary word that performs access control, lazy evaluation, or constraint checks before passing the execution token forward to the true, deep invocation.
Runic Tags:
#structural
#proxy
#forth
#gatekeeping