The Adapter Hex
Bridging incompatible derivation interfaces.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Pure Environment Hexes
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
let
# Old Interface: Expects `{ spellName, spellPower }`
castOldSpell = args: "Casting ''${args.spellName} with power ''${toString args.spellPower}";
# New Interface Object: Has `{ title, magnitude }`
modernGrimoireEntry = {
title = "Quantum Void";
magnitude = 9000;
};
# The Adapter function bridges the new object to the old interface
adapter = modernObj: {
spellName = modernObj.title;
spellPower = modernObj.magnitude;
};
in
castOldSpell (adapter modernGrimoireEntry)
The Adapter pattern maps one attribute structure to another. When working with disparate Nixpkgs versions or integrating third-party flakes, adapters become essential transmutation layers, ensuring hermetic purity despite interface evolution.
Runic Tags:
#structural
#adapter
#nix
#interface