✨ ARCANUM RUNE DIFFICULTY: Apprentice Structural

The Flyweight Sigil

Minimizes memory usage by sharing intrinsic state of thousands of glowing runes.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Flyweight
ARCANUM SCHOOL: Illusion // Phantasm
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
struct rune-type( color: string, glow: bool )
struct rune( x: int, y: int, rtype: rune-type )

val fire-rune-type = rune-type("red", True)
val frost-rune-type = rune-type("blue", False)

pub fun main()
  val r1 = rune(10, 20, fire-rune-type)
  val r2 = rune(15, 25, fire-rune-type)
  val r3 = rune(0, 0, frost-rune-type)
  println("Rune at " ++ r1.x.show ++ " is " ++ r1.rtype.color)
Runic Tags: #koka #flyweight #optimization