The Chain of Responsibility of Snobol
Passing the magical request through a lineage of wizards.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Chain of Responsibility
ARCANUM SCHOOL: Enchantment // Lineage
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SNOBOL PATTERN //
* Chain of Responsibility in SNOBOL4
DEFINE('HANDLE_REQUEST(LEVEL, REQ)')
HANDLE_REQUEST(1, 'LIGHT')
HANDLE_REQUEST(1, 'METEOR')
:(END)
HANDLE_REQUEST
IDENT(LEVEL, 1) IDENT(REQ, 'LIGHT') :S(H1)
IDENT(LEVEL, 1) :S(PASS_TO_2)
H1 OUTPUT = 'Apprentice handled ' REQ :(RETURN)
PASS_TO_2
IDENT(LEVEL, 2) IDENT(REQ, 'METEOR') :S(H2)
OUTPUT = 'Archmage handles ' REQ :(RETURN)
H2 OUTPUT = 'Archmage handled ' REQ :(RETURN)
END
The Chain of Responsibility routes a mystical request up the hierarchy. If an apprentice lacks the power, the execution pointer cascades upward until a capable Archmage resolves the conjuration.
Runic Tags:
#snobol
#behavioral
#chain-of-responsibility