🧱 B PRECURSOR DIFFICULTY: Adept Creational

The Abstract Factory

Forging the precursor runes to spawn ancient objects through typeless invocation.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Artifice
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// B PATTERN //
/* The primordial essence knows no types, only vectors and addresses */

rune_a_forge() {
    auto mem[2];
    mem[0] = 'R'; mem[1] = 'A';
    return mem;
}

rune_b_forge() {
    auto mem[2];
    mem[0] = 'R'; mem[1] = 'B';
    return mem;
}

/* The Abstract Factory is merely an array of forge pointers */
ext factory[2];

init_factory() {
    factory[0] = rune_a_forge;
    factory[1] = rune_b_forge;
}

spawn_rune(type) {
    /* Dynamic dispatch across the void */
    return (factory[type])();
}
Runic Tags: #b #design-pattern #precursor #bell-labs-magic #untyped