Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I mean, at some point you can also make that recursive function take an argument, that decides what to do depending on the type of the item, to make that recursive function reusable, if one has multiple use-cases ... but that's basically the same as the visitor pattern. There really isn't much to it, other than programming language limitations, that necessitate a special implementation, "making it a thing". Like when Java didn't have lambdas and one needed to make visitors objects, ergo had to write a class for them.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: