| ▲ | zelphirkalt 2 days ago | ||||||||||||||||
The visitor pattern is my go to example for patterns, that you don't really need, when you have a language that has first class functions, which implies among other things, that you can pass functions as arguments, like you can pass anything else. The magical "visitor" pattern becomes nothing more than simple callback passing or passing a function, which is one of the most natural things to do in a modern programming language. State machines at least are useful as a conceptual thing, to find a way to think about how one solves a problem, no matter how they are ultimately implemented in the end. | |||||||||||||||||
| ▲ | vips7L 2 days ago | parent [-] | ||||||||||||||||
I've always seen the visitor pattern as a poor-mans pattern matching. How do you solve the same thing with callbacks? | |||||||||||||||||
| |||||||||||||||||