🥞 FORTH STACK DIFFICULTY: Adept Creational

Abstract Factory (Forth)

Bind a factory of void-entities to the active vocabulary plane.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Planarmancy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FORTH PATTERN //
\ Reverse Polish Necromancy: The Abstract Factory
\ We use vocabularies as factories to switch which suite of demons we summon.

VOCABULARY FIRE-PLANE
VOCABULARY ICE-PLANE

FIRE-PLANE DEFINITIONS
: SUMMON-IMP ." A flaming imp erupts from the stack!" CR ;
: SUMMON-FIEND ." A cinder-fiend engulfs the memory bank!" CR ;
FORTH DEFINITIONS

ICE-PLANE DEFINITIONS
: SUMMON-IMP ." A frost imp shivers into existence!" CR ;
: SUMMON-FIEND ." A glacial fiend freezes the pointers!" CR ;
FORTH DEFINITIONS

\ The abstract summoner relies on the active vocabulary
: RITUAL-OF-CREATION ( -- )
  SUMMON-IMP SUMMON-FIEND ;

\ Usage:
\ FIRE-PLANE RITUAL-OF-CREATION
\ ICE-PLANE RITUAL-OF-CREATION

When traversing the deep stack, an Adept does not hardcode their summons. The Abstract Factory is woven through Forth vocabularies. By swapping the active plane (vocabulary), the very same words manifest entirely different entities.

Runic Tags: #creational #abstract-factory #forth #witchcraft