The Bridge Hex
Decoupling a spell's elemental abstraction from its casting mechanism.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Bridge
ARCANUM SCHOOL: Transmutation // Actor Model Hexes
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// MOTOKO PATTERN //
module Bridge {
public type Element = {
ignite : () -> Text;
};
public class FireElement() {
public func ignite() : Text { "Flames" };
};
public class VoidElement() {
public func ignite() : Text { "Darkness" };
};
public type SpellAbstraction = {
cast : () -> async Text;
};
public class Hex(element : Element) {
public func cast() : async Text {
"Casting Hex of " # element.ignite();
};
};
public class Charm(element : Element) {
public func cast() : async Text {
"Casting Charm of " # element.ignite();
};
};
public actor Spellbook {
public func readVoidHex() : async Text {
let voidElem = VoidElement();
let myHex = Hex(voidElem);
await myHex.cast();
};
};
}
The Bridge Hex prevents the combinatorial explosion of spell variants. Instead of a VoidHex and a FireHex, we separate the nature of the magic (Hex, Charm) from the elements they channel (Fire, Void), allowing them to be mixed dynamically at runtime by actors.
Runic Tags:
#motoko
#structural
#bridge
#actor-model