⚡ ZIG ALCHEMY DIFFICULTY: Adept Behavioral

The Template Method: Ritual Blueprint

Define the skeleton of an algorithm in an operation, deferring some steps to subclasses.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Template Method
ARCANUM SCHOOL: Abjuration // Ritual Frameworks
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// BLAZING-FAST ZIG ALCHEMY //
const std = @import("std");

pub const Ritual = struct {
    vtable: *const VTable,
    pub const VTable = struct {
        prepareIngredients: *const fn (self: *Ritual) void,
        ignite: *const fn (self: *Ritual) void,
    };

    pub fn executeRitual(self: *Ritual) void {
        self.vtable.prepareIngredients(self);
        self.vtable.ignite(self);
    }
};

Not every sorcerer understands the full architecture of a grand spell. The Ritual Blueprint defines the unyielding skeleton of the incantation—the Template Method. Acolytes merely provide specific implementations for prepareIngredients and ignite, while the master framework orchestrates the terrifying sequence securely.

Runic Tags: #template-method #behavioral #zig #blueprints