🗼 EIFFEL CONTRACT DIFFICULTY: Apprentice Creational

The Singleton Nexus

A unique focal point of magical power.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Singleton
ARCANUM SCHOOL: Evocation // Leylines
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// EIFFEL PATTERN //
class
    MANA_NEXUS

create {NONE}
    make

feature {NONE} -- Initialization

    make
        do
            power_level := 100
        end

feature -- Access

    instance: MANA_NEXUS
        once
            create Result.make
        ensure
            nexus_exists: Result /= Void
        end

    power_level: INTEGER

end

Eiffel’s once routines make the Singleton naturally robust, providing a guaranteed single locus of power.

Runic Tags: #creational #singleton #eiffel #once