3 ms·
Yes, this is the only place I have ever used the visitor / double dispatch pattern. The main idea is it fulfills the "Open-Closed" principle: https://en.wikipe
by waynecochran 8y ago
Yes, this is the only place I have ever used the visitor / double dispatch pattern. The main idea is it fulfills the "Open-Closed" principle:
https://en.wikipedia.org/wiki/Open–closed_principle https://en.wikipedia.org/wiki/Open–closed_principle
Otherwise you find that your AST data structure is never finished -- you are constantly added stuff to it. I wish there was a clearer way in C++, but this is the C++ solution.