Skip to content

Commit 25827a4

Browse files
goerzKristofferC
authored andcommitted
docs: remove outdated discussion about externally changing module bindings (#53170)
As of Julia 1.9, bindings in modules can be changed directly. See https://discourse.julialang.org/t/clarify-the-documentation-about-modifying-module-variables/109668/3 (cherry picked from commit 736eeda)
1 parent 45c2bd8 commit 25827a4

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

doc/src/manual/variables-and-scoping.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -67,31 +67,7 @@ Each module introduces a new global scope, separate from the global scope of all
6767
is no all-encompassing global scope. Modules can introduce variables of other modules into their
6868
scope through the [using or import](@ref modules) statements or through qualified access using the
6969
dot-notation, i.e. each module is a so-called *namespace* as well as a first-class data structure
70-
associating names with values. Note that while variable bindings can be read externally, they can only
71-
be changed within the module to which they belong. As an escape hatch, you can always evaluate code
72-
inside that module to modify a variable; this guarantees, in particular, that module bindings cannot
73-
be modified externally by code that never calls `eval`.
74-
75-
```jldoctest
76-
julia> module A
77-
a = 1 # a global in A's scope
78-
end;
79-
80-
julia> module B
81-
module C
82-
c = 2
83-
end
84-
b = C.c # can access the namespace of a nested global scope
85-
# through a qualified access
86-
import ..A # makes module A available
87-
d = A.a
88-
end;
89-
90-
julia> module D
91-
b = a # errors as D's global scope is separate from A's
92-
end;
93-
ERROR: UndefVarError: `a` not defined
94-
```
70+
associating names with values.
9571

9672
If a top-level expression contains a variable declaration with keyword `local`,
9773
then that variable is not accessible outside that expression.

0 commit comments

Comments
 (0)