I have seen a lot of discussion related to this and the general consensus seems to be that it would be a mistake to automatically merge functions from different packages. However, is there a way to manually do this?
For example, say I define something like this:
function plot_predictions(model, xs)
plot(xs, predict(model, xs))
end
Then say I am using a few different packages with different models
using Foo # defines ModelFoo and predict(::ModelFoo, xs)
using Bar # defines ModelBar and predict(::ModelBar, xs)
Unfortunately, the packages define different predict functions, meaning that when we try to run the plot_predictions
function, we end up with an error saying we need to qualify predict
(Foo.predict
or Bar.predict
).
Is there a way I can do something like predict = merge(Foo.predict, Bar.predict)
where the method table of the new function is created by merging the method tables of the arguments?