🧱 B PRECURSOR DIFFICULTY: Archmage Structural

The Bridge

Decoupling the abstract Bell Labs invocation from its primordial implementation.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Bridge
ARCANUM SCHOOL: Divination // Connection
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// B PATTERN //
/* Implementation plane */
impl_a(msg) { putchar('A'); }
impl_b(msg) { putchar('B'); }

/* Abstraction plane holds a pointer to the implementation */
auto current_impl;

set_bridge(impl_ptr) {
    current_impl = impl_ptr;
}

invoke_abstraction(msg) {
    /* Crossing the bridge */
    current_impl(msg);
}

execute() {
    set_bridge(impl_a);
    invoke_abstraction(1);

    set_bridge(impl_b);
    invoke_abstraction(2);
}
Runic Tags: #b #design-pattern #precursor #bell-labs-magic #untyped