diff --git a/docs/src/creating-packages.md b/docs/src/creating-packages.md index 488c648d0b..3c489ba03f 100644 --- a/docs/src/creating-packages.md +++ b/docs/src/creating-packages.md @@ -366,7 +366,16 @@ If one considers `PlottingContourExt` as a completely separate package, it could However, for extensions, it is ok to assume that the extension owns the methods in its parent package. In fact, this form of type piracy is one of the most standard use cases for extensions. -An extension will only be loaded if the extension dependencies are loaded from the same environment or environments higher in the environment stack than the package itself. +!!! note + An extension will only be loaded if the extension dependencies are loaded from the same environment or environments + higher in the environment stack than the package itself. This means that you can load a package having an extension + from your main/default environment, load another package required for the dependency from your active project, and + get the functionality from the extension. The other way round does not work, i.e., if you load a package having + an extension from a project environment and then load the package required for the extension from you main/default + environment, the extension will not be loaded. This is different from the behavior of Requires.jl where the + conditional code is evaluated no matter from what environment the "extension dependency" is loaded. + + !!! compat Often you will put the extension dependencies into the `test` target so they are loaded when running e.g. `Pkg.test()`. On earlier Julia versions