ED-Eiffel: Visitor Examples
(mos's homepage)


Visitor is a design pattern that allow the execution of operations on elements of a data structure without changing them. In general, the operation to be performed depends on the type of element. To solve this problem, visitors use a double-dispatch approach. As such, it comes as no surprise that external dispatch is an alternative (simpler and more modular) solution.

In the standard approach to visitors, a visitor class is implemented with a (visit) routine for each element type (see Eiffel visitor, and ED-Eiffel visitor). External dispatch allows two alternative visitor alike approaches: The dual approach of abstracting the element type instead of the visitor (ED-Eiffel element oriented alike visitor); and abstracting both the element type and visitor (ED-Eiffel element-visitor oriented alike visitor).


(mos at ua.pt) University of Aveiro, DETI/IEETA