Proxy in ReasonML
Lazy evaluation and access control via closures.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Proxy
ARCANUM SCHOOL: Abjuration // Shielding
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// REASON PATTERN //
let createSecret = () => "Ancient Knowledge";
let secretProxy = (isAuthenticated) => {
if (isAuthenticated) {
Some(createSecret());
} else {
None;
}
};
Closures act as guardians, only materializing the underlying secret or performing the heavy computation when the correct runes are presented.
Runic Tags:
#reason
#proxy
#structural