The Builder of Arcane Constructs
Step-by-step verification and assembly of complex magical constructs.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Builder
ARCANUM SCHOOL: Conjuration // Construct Assembly
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
module Builder
type construct_state = {
has_core: bool;
has_shell: bool;
}
let init_state = { has_core = false; has_shell = false }
let add_core (s: construct_state) : construct_state =
{ s with has_core = true }
let add_shell (s: construct_state{s.has_core = true}) : construct_state =
{ s with has_shell = true }
let build () =
let s0 = init_state in
let s1 = add_core s0 in
let s2 = add_shell s1 in
s2
The Builder pattern applied to arcane constructs, ensuring via refinement types that a shell cannot be affixed until a power core is present.
Runic Tags:
#builder
#constructs
#state-machine