Interesting approach to emulating sum types in Go: define an interface with a placeholder function on all of the relevant types! https://www.jerf.org/iri/post/2917
Includes an example with an AST type. You can even stop people extending your interface by making your placeholder private.
Related Posts
The best interface is no interface: https://web.archive.org/web/20120831083217/http://www.cooper.com/journal/2012/08/the-best-interface-is-no-interface.html/
The author's critique of needing to find an app to accomplish a task is just as relevant today.
Shower thought: Printing runtime values is far more useful for product types than sum types.
For a struct it's useful to see all the fields, but for a nullable int it's less useful to see 123.
Are there examples of IDE services deliberately leveraging elaborate type systems?
I'm struggling to think of what a richer type system enables in the IDE space. The existence of void* in C, interface{} in Go, or a lack of generics, doesn't seem to have limited possibilities.