Template Method in Dhall
Define the skeleton of a ritual while delegating specific steps.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Template Method
ARCANUM SCHOOL: Evocation // Rituals
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// DHALL PATTERN //
let RitualSteps =
{ prepare : Text
, execute : Text
, cleanup : Text
}
let performRitual = \(steps : RitualSteps) ->
steps.prepare ++ " -> " ++ steps.execute ++ " -> " ++ steps.cleanup
let haltingRitual : RitualSteps =
{ prepare = "Draw Circle"
, execute = "Chant 'Halt'"
, cleanup = "Erase Circle"
}
in performRitual haltingRitual
The Template Method provides a backbone for strict order-of-operations. In Dhall, one creates a master function that expects a record of customizable steps. The skeleton strictly dictates the flow of evaluation, while the injected properties ensure flexibility.
Runic Tags:
#dhall
#halting
#runes
#configuration
#behavioral