Hacker News new | past | comments | ask | show | jobs | submit login

The last example is a classic visitor pattern. The earlier ones (using structs of functions) are a variation on this that seems a bit closer to the spirit of pattern matching.

hi, i am the author of the article.

> The last example is a classic visitor pattern

you are absolutely right about the visitor pattern. will add the specific reference to the pattern in a revised version.

thanks for pointing out!

Applications are open for YC Summer 2020

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