Skip to content

Commit 94a7619

Browse files
committed
docs: add note about not implying being defined to names
ref #51584
1 parent 165f728 commit 94a7619

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

base/reflection.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ are also included.
8484
As a special case, all names defined in `Main` are considered \"public\",
8585
since it is not idiomatic to explicitly mark names from `Main` as public.
8686
87+
!!! note
88+
`sym ∈ names(SomeModule)` does *not* imply `isdefined(SomeModule, sym)`,
89+
because the value returned by `names` will contain a symbol marked with `public`
90+
(or `export`) in the module, even if that symbol does not correspond to any names
91+
defined in the module.
92+
8793
See also: [`isexported`](@ref), [`ispublic`](@ref), [`@locals`](@ref Base.@locals), [`@__MODULE__`](@ref).
8894
"""
8995
names(m::Module; all::Bool = false, imported::Bool = false) =

0 commit comments

Comments
 (0)