✨ GLEAM ALCHEMY DIFFICULTY: Adept Structural

The Proxy

Controlling access to powerful relics via actor intermediaries.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Proxy
ARCANUM SCHOOL: Transmutation // Warding
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// GLEAM PATTERN //
import gleam/erlang/process.{type Subject}

pub type VaultMsg {
  Unlock(passphrase: String, reply_to: Subject(Result(String, String)))
}

pub fn access_vault(vault: Subject(VaultMsg), pass: String) -> Result(String, String) {
  process.call(vault, fn(reply_to) { Unlock(pass, reply_to) }, 1000)
}

The Proxy

Actor boundaries serve as excellent proxies, controlling access to resources through message passing.

Runic Tags: #transmutation #proxy #gleam #otp