I just started using the package extension functionality introduced after v1.9. I am a bit confused about its usage. Can I ask when the package extension is loaded, where are the new functions (which are not defined in the original package) registered?
For example, there are some new functions in ext/ForwardDiffStaticArraysExt.jl
such as dualize
. How can I use it if I want to (just an example, not that I really need it)? Here are my attempts:
julia> using ForwardDiff: dualize
ERROR: UndefVarError: `dualize` not defined
julia> using StaticArrays
julia> using ForwardDiff: dualize
ERROR: UndefVarError: `dualize` not defined
julia> using ForwardDiff
julia> names(ForwardDiff)
2-element Vector{Symbol}:
:DiffResults
:ForwardDiff
julia> using ForwardDiff.ForwardDiffStaticArraysExt
ERROR: UndefVarError: `ForwardDiffStaticArraysExt` not defined
julia> using ForwardDiffStaticArraysExt
ERROR: ArgumentError: Package ForwardDiffStaticArraysExt not found in current path.
- Run `import Pkg; Pkg.add("ForwardDiffStaticArraysExt")` to install the ForwardDiffStaticArraysExt package.
Stacktrace:
[1] macro expansion
@ ./loading.jl:1595 [inlined]
[2] macro expansion
@ ./lock.jl:267 [inlined]
[3] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1576
Are package extensions only used for extending existing methods? Can I define new methods and use them?