Hacker News new | ask | show | jobs
by Q6T46nT668w6i3m 2668 days ago
I’ve never considered this, but I think it’s a fair assessment! It’s particularly striking when you see a compiler with multiple visitors that are refactored into one or two visitors to reduce the number of traversals. I think I understand the cause, it’s easier to start with a visitor pattern than refactoring into a visitor pattern.

Nevertheless, for many problems, like compiler construction, I’ve never seen a pattern that matched the utility of the visitor (even outside of imperative and object-oriented patterns)

2 comments

Use the right language: one with ML style pattern matching.
check out multi-methods and multiple-dispatch OO