The Proxy Homunculus
Controls access to a master wizard through a loyal homunculus effect handler.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Proxy
ARCANUM SCHOOL: Conjuration // Homunculi
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
effect wizard
ctl ask-secret(password: string) : string
fun master-wizard(action: () -> <wizard|e> a) : e a
with handler
ctl ask-secret(_) resume("The universe is a hologram")
action()
fun proxy-wizard(action: () -> <wizard|e> a) : <wizard|e> a
with handler
ctl ask-secret(pwd)
if pwd == "mellon" then resume(ask-secret(pwd))
else resume("Access denied by the Homunculus!")
action()
pub fun main()
with master-wizard
with proxy-wizard
println(ask-secret("wrong"))
println(ask-secret("mellon"))
Runic Tags:
#koka
#proxy
#access-control