Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove outdated discussion about externally changing module bindings #53170

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions doc/src/manual/variables-and-scoping.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,32 +67,7 @@ Each module introduces a new global scope, separate from the global scope of all
is no all-encompassing global scope. Modules can introduce variables of other modules into their
scope through the [using or import](@ref modules) statements or through qualified access using the
dot-notation, i.e. each module is a so-called *namespace* as well as a first-class data structure
associating names with values. Note that while variable bindings can be read externally, they can only
be changed within the module to which they belong. As an escape hatch, you can always evaluate code
inside that module to modify a variable; this guarantees, in particular, that module bindings cannot
be modified externally by code that never calls `eval`.

```jldoctest
julia> module A
a = 1 # a global in A's scope
end;

julia> module B
module C
c = 2
end
b = C.c # can access the namespace of a nested global scope
# through a qualified access
import ..A # makes module A available
d = A.a
end;

julia> module D
b = a # errors as D's global scope is separate from A's
end;
ERROR: UndefVarError: `a` not defined in `D`
Suggestion: check for spelling errors or missing imports.
```
associating names with values.

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