☎️ ERLANG HIVE DIFFICULTY: Adept Creational

The Factory Method of the Hive Switchboard

Deferring spirit incarnation to specialized sub-cults.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Factory Method
ARCANUM SCHOOL: Conjuration // Calling
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ERLANG PATTERN //
-module(the_factory_method).
-export([summon/1]).

summon(Type) -> 
    Pid = create(Type),
    {ok, Pid}.

create(warrior) -> spawn(fun() -> warrior_loop() end);
create(mage) -> spawn(fun() -> mage_loop() end).

warrior_loop() -> receive _ -> warrior_loop() end.
mage_loop() -> receive _ -> mage_loop() end.

The Factory Method

The exact essence of the spirit is determined by the runes passed in, shielding the caller from the raw psychic mechanics of creation.

Runic Tags: #erlang #actors #telepathy #switchboard #factory-method