**This issue relates to #35 ** (should probably be a subtask of it).
This exercise is a wrong use case of the visitor pattern. The appropriate pattern to use here is the Interpreter pattern.
While it is true that one can implement a grammar-like interpretation with a visitor, this is pretty artificial and forces to break encapsulation. (Encapsulation breakage is the major inconvenient of Visitor pattern and built in it).
An exercise about the visitor pattern should start by recalling what double dispatch is and provide an example that requires it.
**This issue relates to #35 ** (should probably be a subtask of it).
This exercise is a wrong use case of the visitor pattern. The appropriate pattern to use here is the Interpreter pattern.
While it is true that one can implement a grammar-like interpretation with a visitor, this is pretty artificial and forces to break encapsulation. (Encapsulation breakage is the major inconvenient of Visitor pattern and built in it).
An exercise about the visitor pattern should start by recalling what double dispatch is and provide an example that requires it.