Skip to content

Commit

Permalink
don't export macros whose names start with underscores (#2270)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlubin authored Jul 11, 2020
1 parent 29f64d8 commit 9aa2bf6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/JuMP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,8 @@ include("callbacks.jl")
include("file_formats.jl")

# JuMP exports everything except internal symbols, which are defined as those
# whose name starts with an underscore. If you don't want all of these symbols
# whose name starts with an underscore. Macros whose names start with
# underscores are internal as well. If you don't want all of these symbols
# in your environment, then use `import JuMP` instead of `using JuMP`.

# Do not add JuMP-defined symbols to this exclude list. Instead, rename them
Expand All @@ -1012,7 +1013,8 @@ const _EXCLUDE_SYMBOLS = [Symbol(@__MODULE__), :eval, :include]

for sym in names(@__MODULE__, all=true)
sym_string = string(sym)
if sym in _EXCLUDE_SYMBOLS || startswith(sym_string, "_")
if sym in _EXCLUDE_SYMBOLS || startswith(sym_string, "_") ||
startswith(sym_string, "@_")
continue
end
if !(Base.isidentifier(sym) || (startswith(sym_string, "@") &&
Expand Down

0 comments on commit 9aa2bf6

Please sign in to comment.