PrivateModules
Make unexported symbols private.
Contents
Installation
This package is registered in METADATA.jl and so can be installed using Pkg.add
Pkg.add("PrivateModules")Public Interface
PrivateModules — Module.PrivateModules.@private — Macro.Make unexported symbols in a module private.
Signature
@private module ... endExample
using PrivateModules
@private module M
export f
f(x) = g(x, 2x)
g(x, y) = x + y
end
using .M
f(1) # works
M.g(1, 2) # failsPrivateModules.@local — Macro.Local import, importall and using macro.
Signature
@local expressionExamples
function func(args...)
@local using A, ..B, C.D
# ...
endExported symbols from A, ..B, and C.D are bound to local constants in func's scope.
function func(args...)
@local importall A, ..B, C.D
# ...
endAll symbols from A, ..B, and C.D are bound to local constants in func's scope.
function func(args...)
@local import A, ..B, C.D
# ...
endA, B, and D are bound to local constants in func's scope.
Notes
Macros cannot be imported using the
@localmacro.Modules listed in
@localcalls must be literals - not variables.
Internals
PrivateModules.exports — Function.Signature
exports(outer, inner)Import all exported symbols from inner module into outer one and then re-export them.