🦊 FOXPRO APPARITION DIFFICULTY: Archmage Behavioral

The Visitor of the Astral Projection

Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Visitor
ARCANUM SCHOOL: Divination // Astral Walking
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FOXPRO PATTERN //
DEFINE CLASS SpiritNode AS Custom
    PROCEDURE Accept(oVisitor)
    ENDPROC
ENDDEFINE

DEFINE CLASS PoltergeistNode AS SpiritNode
    PROCEDURE Accept(oVisitor)
        oVisitor.VisitPoltergeist(THIS)
    ENDPROC
ENDDEFINE

DEFINE CLASS WraithNode AS SpiritNode
    PROCEDURE Accept(oVisitor)
        oVisitor.VisitWraith(THIS)
    ENDPROC
ENDDEFINE

DEFINE CLASS AstralVisitor AS Custom
    PROCEDURE VisitPoltergeist(oNode)
        ? "Analyzing the telekinetic disruption of the Poltergeist."
    ENDPROC

    PROCEDURE VisitWraith(oNode)
        ? "Measuring the cold life-drain aura of the Wraith."
    ENDPROC
ENDDEFINE

When the structure of your spiritual hierarchy is rigid but you must divine entirely new properties from them, the Visitor walks among them astrally. Each entity accepts the visitor, revealing their secrets without altering their own ancient code.

Runic Tags: #behavioral #visitor #double-dispatch #extensions