The Prototype Hex
Clone existing entities without binding your spells to their exact classes.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Conjuration // Replication
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
use fmt;
type Familiar = struct {
name: str,
energy: uint,
};
fn clone_familiar(f: *Familiar) Familiar = {
return Familiar {
name = f.name,
energy = f.energy,
};
};
export fn main() void = {
let original = Familiar { name = "Byte", energy = 100 };
let copy = clone_familiar(&original);
fmt::printfln("Cloned {} with {} energy.", copy.name, copy.energy)!;
};
Why conjure anew when you can duplicate? The Prototype hex simply copies the raw memory layout of a known working construct, skipping the expensive initialization rituals.
Runic Tags:
#creational
#prototype
#simple-systems-hexes