Is this design pattern of `::Val{}` dispatching evil?

In case this is still relevant, I just wrote a small package called ValSplit.jl that allows users to dispatch on Val-typed arguments without incurring the overhead of dynamic dispatch!

In contrast to using constant global dictionary, it’s both faster and more extensible. (Unlike a global dictionary though, it will prevent users from modifying what function a particular Symbol maps to, if the corresponding method is already defined in the base package.)

2 Likes