We are using Makie to build up some plotting extensions for a few packages, but we have older extension methods for Plots as well. If the user only have Plots or only has Makie, everything works, but what if they have included both in the session? Is there a way to set a default?
I would say the methods that you extend should not be exactly the same in both extensions, overwriting each other if both are loaded. You could put one more argument in which is just a singleton like Val(:Plots)
or Val(:Makie)
and then you have a Ref
or so in your main module which the extensions set to their own symbol on init. Then if both are loaded, it depends on the loading order which one is active, but at least the user could still do YourPackage.use!(:Makie)
or something. So someplot(args...)
that the user calls would dispatch first to someplot(ACTIVE_BACKEND[], args...)
.