-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
Right now when a user wants to use an extension, they load the dependency themselves, and this triggers the extension. However, this requires the user to know when for what part of the code need to use it.
I think it would be very useful for downstream users of a package if there was a way for a package maintainer to automatically trigger a particular extension from within their package.
For example, say I want to use Zygote.jl inside my package, but only for some rarely-used branch of my code. Due to the 300ms load time, I don't want to always load it. I could set up an extension, but it would require all downstream users to load Zygote.jl manually. But downstream users might not even know where Zygote is being used inside the package, or if it is being used at all.
So, it would be great if there could be a way to manually trigger an extension to load. Something like Base.load_extension(@__MODULE__, :ZygoteExt)
, similar to get_extension
.
@KristofferC wdyt?
Related discussion: johnnychen94/LazyModules.jl#10
Edit: here's a clarifying post: #49990 (comment)