The Interpreter Pattern
Evaluating arcane runes and magical syntax.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Interpreter
ARCANUM SCHOOL: Divination // Linguistics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SWIFT PATTERN //
protocol Expression {
func evaluate(_ context: String) -> Bool
}
class FireRuneExpression: Expression {
func evaluate(_ context: String) -> Bool {
return context.contains("Ignis")
}
}
The Interpreter: Reading the Runes
The Interpreter evaluates whether a given sequence of incantations contains the required runes, acting as a magical syntax parser.
Runic Tags:
#swift
#design-pattern
#behavioral