The Prototype
Cloning magical essence without shared references.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Conjuration // Replication
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// GLEAM PATTERN //
pub type Spellbook {
Spellbook(spells: List(String), owner: String)
}
pub fn clone_and_reassign(book: Spellbook, new_owner: String) -> Spellbook {
// Structural sharing and immutability make this a true prototype
Spellbook(..book, owner: new_owner)
}
The Prototype
In an immutable world, all values are prototypes. Cloning is as simple as using record update syntax.
Runic Tags:
#conjuration
#prototype
#gleam