The Flyweight of Snobol
Sharing intrinsic magical essence to save runic space.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Flyweight
ARCANUM SCHOOL: Transmutation // Compression
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SNOBOL PATTERN //
* Flyweight Pattern in SNOBOL4
* Intrinsic state is a shared string
ESSENCE_FIRE = 'Shared Fire Essence'
* Extrinsic state (position) is kept separate
SPELL_A = ESSENCE_FIRE ' at coords 10,20'
SPELL_B = ESSENCE_FIRE ' at coords 30,40'
OUTPUT = SPELL_A
OUTPUT = SPELL_B
END
When the Grimoire grows too large, the Flyweight pattern condenses memory. The shared essence of an element is stored in a single variable, and only the unique, extrinsic coordinates are added upon casting.
Runic Tags:
#snobol
#structural
#flyweight