Abstract Factory in Dhall
Conjure complete sets of configuration runes without revealing their concrete types.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Runecrafting
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// DHALL PATTERN //
let Button = { render : Text }
let Checkbox = { render : Text }
let GUIFactory =
{ createButton : Button
, createCheckbox : Checkbox
}
let WinFactory : GUIFactory =
{ createButton = { render = "Windows Halting Button Rune" }
, createCheckbox = { render = "Windows Halting Checkbox Rune" }
}
let MacFactory : GUIFactory =
{ createButton = { render = "Mac Halting Button Rune" }
, createCheckbox = { render = "Mac Halting Checkbox Rune" }
}
in { win = WinFactory, mac = MacFactory }
In the guaranteed-halting environment of Dhall, the Abstract Factory acts as a unified grimoire for producing related configuration runes. By returning a record of functions or records, it allows archmages to easily swap out entire families of magical configurations without rewriting the incantations that depend on them.
Runic Tags:
#dhall
#halting
#runes
#configuration
#creational