I am making a package where a small subset of the functionality currently requires type piracy. I’d like to make users have to explicitly import this package separately from the main package in order to access this functionality, so that the type piracy does not occur if they do not need it.
How can I accomplish this? I was planning to put it in a submodule which users have to explicitly import, but it seems like the type piracy still occurs even without importing it?
Making a separate library seems a bit clunky, and I’ve found them hard to develop simultaneously with a main library – I was wondering if there’s any other option like only eval’ing the type piracy code if the user loads the submodule, e.g. by
function enable_type_piracy() @eval type piracy end
but what are the pitfalls of this approach or are there any other less hacky ones?