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.
Provides an @private
macro for hiding unexported symbols and scoped import macro @local
.
#
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
Methods
-
@private(x::ANY<:Any)
defined at src/PrivateModules.jl:46
#
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.
Methods
-
@local(x::ANY<:Any)
defined at src/PrivateModules.jl:91
Internals
#
PrivateModules.exports
— Function.
Signature
exports(outer, inner)
Import all exported symbols from inner
module into outer
one and then re-export them.
Methods
-
exports(outer, inner)
defined at src/PrivateModules.jl:80