🐎 PONY WARD DIFFICULTY: Apprentice Creational

The Prototype Ward

Cloning magical essences using val capabilities.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Illusion // Duplication
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PONY PATTERN //
trait val Cloneable
  fun clone(): Cloneable val

class val Illusion is Cloneable
  let _power: U32
  new create(p: U32) => _power = p
  fun clone(): Illusion val => Illusion(_power)

The Prototype Ward

In Pony, deep cloning is often replaced by sharing immutable val references. When a true structural duplicate is required, the Prototype spell returns a new val or iso instance.

Runic Tags: #pony #prototype