While I agree with your comments about the general principle, I don’t think this is a particularly good example — the uses of sample
in Turing and StatsBase don’t have anything to do with each other, so it is just recycling the symbol for something completely different, not an example of generic programming. Technically fine, but not good style. See this topic.
Generally, defining & exporting a function f
in a ...Base
package is useful if it is part of a generic interface other packages may extend, or just use without restricting to a particular type in mind. Nice examples include