From 0acf1829b7a2c34301cc339d7823eec790ed911f Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Wed, 7 Feb 2024 10:03:21 -0500 Subject: [PATCH] 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 736eeda72493f02247994785d5b5a9c8f9dca2f5) --- doc/src/manual/variables-and-scoping.md | 26 +------------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/doc/src/manual/variables-and-scoping.md b/doc/src/manual/variables-and-scoping.md index c763d62680091..cc15dc32b82bd 100644 --- a/doc/src/manual/variables-and-scoping.md +++ b/doc/src/manual/variables-and-scoping.md @@ -67,31 +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 -``` +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.