Visitor¶
Stable ID: pattern.visitor
Kind: design-pattern
Status: stable
Source: skill/references/design-patterns/visitor.md
Purpose¶
Add operations across a stable heterogeneous structure without distributing each operation across every element type.
Use when¶
- The data structure is stable while operations grow independently.
- Double dispatch or exhaustive traversal provides clear ownership.
Avoid when¶
- Element types change frequently.
- Pattern matching or ordinary polymorphism is simpler.
Applicability¶
- Languages:
any,python,q-kdbplus,cpp,rust,dart-flutter,typescript - Related entries: None