From 177cf8cca3c9af1d45540e0bc5729e139f690fa5 Mon Sep 17 00:00:00 2001 From: Vic <35498248+VictorelPetrovich@users.noreply.github.com> Date: Tue, 23 Oct 2018 19:51:11 -0700 Subject: [PATCH 1/3] Created an actual table It looks clearer to me, by showing immediately the *constructs* the document talks about. In the the original tree , a complete beginner may confuse which are the constructs, and which are the types of scope Also removed the mention "(don't allow nesting)" in the 5th branch of the tree, as that is already stated by the 1st branch of the tree (It had actually confused me https://discourse.julialang.org/t/scope-of-struct-and-macro/16714 ) --- doc/src/manual/variables-and-scoping.md | 33 ++++++++----------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/doc/src/manual/variables-and-scoping.md b/doc/src/manual/variables-and-scoping.md index 40bed258c30d3..4597b5fb7afec 100644 --- a/doc/src/manual/variables-and-scoping.md +++ b/doc/src/manual/variables-and-scoping.md @@ -13,29 +13,16 @@ set of source lines; instead, it will always line up with one of these blocks. T main types of scopes in Julia, *global scope* and *local scope*. The latter can be nested. The constructs introducing scope blocks are: -# [](@id man-scope-table) - - * Scope blocks that may nest only in other global scope blocks: - - - global scope - - + [`module`](@ref), [`baremodule`](@ref) - - + at interactive prompt (REPL) - - - local scope (don't allow nesting) - - + (mutable) [`struct`](@ref), [`macro`](@ref) - - * Scope blocks which may nest anywhere (in global or local scope): - - - local scope - - + [`for`](@ref), [`while`](@ref), [`try-catch-finally`](@ref try), [`let`](@ref) - - + functions (either syntax, anonymous & do-blocks) - - + comprehensions, broadcast-fusing +### [Scope constructs](@id man-scope-table) + +Construct | Scope type | Scope blocks it may be nested in +------------ | ------------- |--------------------------- +[`module`](@ref), [`baremodule`](@ref) | global | other global +interactive prompt (REPL) | global | other global +(mutable) [`struct`](@ref), [`macro`](@ref) | local | other global +[`for`](@ref), [`while`](@ref), [`try-catch-finally`](@ref try), [`let`](@ref) |local | other local + functions (either syntax, anonymous & do-blocks) | local | other local + comprehensions, broadcast-fusing | local | other local Notably missing from this table are [begin blocks](@ref man-compound-expressions) and [if blocks](@ref man-conditional-evaluation) From 9d33915da7056a8227733dce5e55f4513db401e8 Mon Sep 17 00:00:00 2001 From: Vic <35498248+VictorelPetrovich@users.noreply.github.com> Date: Wed, 24 Oct 2018 08:51:42 -0700 Subject: [PATCH 2/3] removed trailing spaces in l. 24 & 25 --- doc/src/manual/variables-and-scoping.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/manual/variables-and-scoping.md b/doc/src/manual/variables-and-scoping.md index 4597b5fb7afec..61a1f3d5a7b3b 100644 --- a/doc/src/manual/variables-and-scoping.md +++ b/doc/src/manual/variables-and-scoping.md @@ -21,8 +21,8 @@ Construct | Scope type | Scope blocks it may be nested in interactive prompt (REPL) | global | other global (mutable) [`struct`](@ref), [`macro`](@ref) | local | other global [`for`](@ref), [`while`](@ref), [`try-catch-finally`](@ref try), [`let`](@ref) |local | other local - functions (either syntax, anonymous & do-blocks) | local | other local - comprehensions, broadcast-fusing | local | other local +functions (either syntax, anonymous & do-blocks) | local | other local +comprehensions, broadcast-fusing | local | other local Notably missing from this table are [begin blocks](@ref man-compound-expressions) and [if blocks](@ref man-conditional-evaluation) From e377db0a65a9839cd2588920867ca5e98daa707e Mon Sep 17 00:00:00 2001 From: Vic <35498248+VictorelPetrovich@users.noreply.github.com> Date: Thu, 25 Oct 2018 08:55:59 -0700 Subject: [PATCH 3/3] corrected the last 3 rows for the scope blocks they may nested in --- doc/src/manual/variables-and-scoping.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/manual/variables-and-scoping.md b/doc/src/manual/variables-and-scoping.md index 61a1f3d5a7b3b..eae8c87bb8318 100644 --- a/doc/src/manual/variables-and-scoping.md +++ b/doc/src/manual/variables-and-scoping.md @@ -17,12 +17,12 @@ constructs introducing scope blocks are: Construct | Scope type | Scope blocks it may be nested in ------------ | ------------- |--------------------------- -[`module`](@ref), [`baremodule`](@ref) | global | other global -interactive prompt (REPL) | global | other global -(mutable) [`struct`](@ref), [`macro`](@ref) | local | other global -[`for`](@ref), [`while`](@ref), [`try-catch-finally`](@ref try), [`let`](@ref) |local | other local -functions (either syntax, anonymous & do-blocks) | local | other local -comprehensions, broadcast-fusing | local | other local +[`module`](@ref), [`baremodule`](@ref) | global | global +interactive prompt (REPL) | global | global +(mutable) [`struct`](@ref), [`macro`](@ref) | local | global +[`for`](@ref), [`while`](@ref), [`try-catch-finally`](@ref try), [`let`](@ref) |local | global or local +functions (either syntax, anonymous & do-blocks) | local | global or local +comprehensions, broadcast-fusing | local | global or local Notably missing from this table are [begin blocks](@ref man-compound-expressions) and [if blocks](@ref man-conditional-evaluation)