⚙️ MOTOKO RUNE DIFFICULTY: Adept Creational

The Abstract Factory Hex

Summoning related families of actor hexes without specifying their concrete demonic origins.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Actor Model Hexes
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// MOTOKO PATTERN //
module AbstractFactory {
  public type ActorHex = {
    invoke : () -> async Text;
  };

  public type HexFactory = {
    createCurse : () -> ActorHex;
    createBlessing : () -> ActorHex;
  };

  public class DemonHexFactory() {
    public func createCurse() : ActorHex {
      object {
        public func invoke() : async Text { "Hellfire Curse Invoked!" };
      }
    };
    public func createBlessing() : ActorHex {
      object {
        public func invoke() : async Text { "Dark Boon Granted!" };
      }
    };
  };

  public class CelestialHexFactory() {
    public func createCurse() : ActorHex {
      object {
        public func invoke() : async Text { "Holy Smite Invoked!" };
      }
    };
    public func createBlessing() : ActorHex {
      object {
        public func invoke() : async Text { "Divine Shield Granted!" };
      }
    };
  };
}

The Abstract Factory Hex allows a summoner to forge complete families of associated actor hexes. Whether weaving demonic curses or celestial blessings, the client actor remains isolated from the specific sigil implementations, interacting purely through the HexFactory interface.

Runic Tags: #motoko #creational #abstract-factory #actor-model