I'm wondering how does Nim provide language facilities to solve the expression problem: https://en.wikipedia.org/wiki/Expression_problem#cite_note-Scala-10
Here are also discussions in hack news: https://news.ycombinator.com/item?id=11683379
I guess it's a powerful idea to make Nim a more extensible language.
You have both sum types and inheritance so you have both side of the coin, then you have metaprogramming to tie them together anyway you want it.
For example you can use macros to create your case statement like we do in Nimbus VM here:
So we get the benefits of both sum types with inheritance-like declaration: https://github.com/status-im/nimbus/blob/2521ff195037d0e17601c013b7cc6ddefc4dce6f/nimbus/vm/interpreter/opcodes_impl.nim#L30-L40
Furthermore the case dispatch is done using {.computedGoto.} which is much faster than plain case/switch or VTable dispatch: https://github.com/status-im/nimbus/wiki/Interpreter-optimization-resources