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 ... end
Example
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) # fails
PrivateModules.@local
— Macro.Local import
, importall
and using
macro.
Signature
@local expression
Examples
function func(args...)
@local using A, ..B, C.D
# ...
end
Exported 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
# ...
end
All 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
# ...
end
A
, B
, and D
are bound to local constants in func
's scope.
Notes
Macros cannot be imported using the
@local
macro.Modules listed in
@local
calls 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.