-
You must not use
Val
this way in real code. And that’s exactly becauseI know that this is probably a flagrant abuse of Val
-
Dispatch is fundamentally more complex than a dict look up because type matching is much more complex than hash lookup and direct value comparison. Dict lookup also doesn’t need to worry about multiple matches/specifity/ambiguity. It may be possible to make dispatch matches dict lookup performance but it’ll never be better and will in general be much worse.
4 Likes