In general, type computations in Julia are made for things that should be done at compilation time. If you cannot do the calculation at compilation time, then you will get performance hits by using the dispatch system (but if you can do things at compilation time, then you will get performance gains!). So it’s a tool to be used wisely.
In this case, it sounds like you want to dispatch on runtime values. This means you are in the case where you will get performance losses. From what I measured this means using dispatch to do this kind of things gives about a 100ns hit per function call that is uninferred because of it. So a function barrier approach is fine if it’s not in an inner loop, but you may want to think about just writing out a conditional instead. Due to branch prediction, solving an equation repeatedly with a given set of parameter values is something that will make the branch cost almost disappear on modern CPUs, so it doesn’t really need to be avoided. Though this may be not as nice looking stylistically as using dispatch would.
Ultimately, it’s a choice of style and performance, but I think it’s wise, not just for performance but also for style, to keep type computations and dispatch for compile-time computations.