The Template Method
Defining the skeleton of a high-ritual, allowing acolytes to fill in the specific somatic components.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Template Method
ARCANUM SCHOOL: Necromancy // Ritual Skeleton
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// OCAML PATTERN //
let perform_ritual ~prepare ~invoke ~clean =
prepare ();
invoke ();
clean ()
let raise_skeleton () =
perform_ritual
~prepare:(fun () -> print_endline "Gathering bones.")
~invoke:(fun () -> print_endline "Animating dead.")
~clean:(fun () -> print_endline "Scrubbing blood.")
The Template Method shines with OCaml’s labeled arguments. The high-ritual outlines the algorithm, while specific closures dictate the grim details.
Runic Tags:
#Caml Metamagic
#Named Arguments
#Higher-Order Functions
#OCaml