You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make Base.get_extension private to prevent user mistakes
Added in #58108 without valid justification: something
simply being documented in the manual is never any allowable argument
for making something public. Being public is confusing users, since all
of the other related infrastructure is also declared private (project
files, `loaded_modules_array`, `PkgId`, `require`, etc.). Some of those
do have legit uses in reflection testing, but we don't currently have a
representation for this sort of private-except-reflection in most places
(other than `Core.IR`).
However is not allowed for packages to call `Base.get_extension`, since
it requires accessing private implementation details of the target
package to construct the arguments, and can run afoul of various
implementation rules (world ages, module identity, precompile file
consistency) that can lead to buggy execution.
The correct way to use this functionality is with dispatch. Loosely:
```julia
module Main
function get_extension end
end
module MainPkgExt # extension module in Main
using Other
Main.get_extension(args...) = Other.call(args...)
end
```
0 commit comments