⚙️ STARLARK RUNE DIFFICULTY: Adept Creational

The Abstract Factory

Conjuring hermetic realms of related build charms.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Hermetic Charms
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// STARLARK PATTERN //
def _create_cyber_forge():
    return struct(
        forge_weapon = lambda: "Plasma Katana",
        forge_armor = lambda: "Nanotech Weave"
    )

def _create_aether_forge():
    return struct(
        forge_weapon = lambda: "Aetherial Staff",
        forge_armor = lambda: "Mage-Plate"
    )

def get_forge(realm):
    if realm == "cyber":
        return _create_cyber_forge()
    elif realm == "aether":
        return _create_aether_forge()
    fail("Unknown hermetic realm: " + realm)

# Usage
forge = get_forge("cyber")
weapon = forge.forge_weapon()

In the deterministic void of Starlark, where side-effects are banished and execution is pristine, the Abstract Factory pattern operates as a realm-selector for your build charms. When weaving massive dependency graphs, one must often switch paradigms—from cybernetic micro-services to aetherial monolithic artifacts—without shattering the underlying hermetic seals. By encapsulating structural creation in struct definitions, Starlark mages can ensure that all artifacts conjured are flawlessly compatible with the active realm.

Runic Tags: #creational #starlark #hermetic