A few of us (@piever, @sdanisch) have been discussing the issue of optional dependencies again, unsatisfied w/ current solutions (having to invert dependency chains, Requires.jl performance issues + clunkiness, etc.). One idea that has recently been brought up is the idea of a SharedFunctions.jl package:
- it would be restricted to empty generic function definitions (e.g.
function foo end); this is important for keeping the package small & performant, as well as a very low-risk dependency
- each generic function would have a sole “owner” package, in charge of providing documentation/maintenance, as well as being the sole package allowed to provide generic fallback definitions of the generic shared function (i.e. allowed piracy)
- once a function was “registered” in SharedFunctions.jl, it wouldn’t be allowed to be removed to prevent any form of breakage (possibly this could be relaxed if it could be proven that all extenders of the function had already removed their extensions of it).
A group of packages could obviously coordinate such an “interface” package and some have (IteratorInterfaceExtensions, StatsBase to some extent, etc.), but I feel there would be value in having a community-driven “solution” w/ well-documented practices, in particular for scenarios when there are only a few generic functions that need to be shared by a group of packages (obviously if there’s a situation where a group of packages needed to share/overload hundreds/thousands of functions, it would hurt perf of SharedFunctions.jl, so they’d be better off making their own interface package). I feel like it could provide a nice solution, shared place people could go, make a PR for a new shared function, and not have to worry about registering their own interface package or coordinating things.
Thoughts? Good idea? Unexpected downsides I’m not considering? I feel like I’d like to get the ball rolling on something like this.