❄️ SNOBOL HEX DIFFICULTY: Adept Creational

The Abstract Factory of Snobol

Weaving arcane string patterns to forge entire families of magical artifacts.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Patternmancy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SNOBOL PATTERN //
        * Abstract Factory in SNOBOL4
        * We construct a factory using pattern variables
        DEFINE('CREATE_FIRE_WAND()')
        DEFINE('CREATE_ICE_WAND()')

        * Factory invocation
        FACTORY = 'FIRE'
        WAND = EVAL('CREATE_' FACTORY '_WAND()')
        OUTPUT = WAND

CREATE_FIRE_WAND
        CREATE_FIRE_WAND = 'Wand of True Fire' :(RETURN)

CREATE_ICE_WAND
        CREATE_ICE_WAND = 'Wand of Pure Ice' :(RETURN)
END

Deep in the string-weaver’s sanctum, the Abstract Factory pattern takes the form of dynamic evaluation. By defining our creation spells and invoking them through the primordial EVAL function, we can conjure entire families of magical objects without hardcoding the incantations.

Runic Tags: #snobol #strings #creational #magic