Skip to content

Commit 522624c

Browse files
authored
docs: fix scope type of a struct to hard (#56755)
Is struct not a hard scope? ```jl julia> b = 1 struct Tester tester Tester(tester) = new(tester) b = 2 Tester() = new(b) end b 1 ```
1 parent fc9e7c4 commit 522624c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ The constructs introducing scope blocks are:
6464
| Construct | Scope Type Introduced | Scope Types Able to Contain Construct |
6565
|:----------|:----------------------|:--------------------------------------|
6666
| [`module`](@ref), [`baremodule`](@ref) | global | global |
67-
| [`struct`](@ref) | local (soft) | global |
67+
| [`struct`](@ref) | local (hard) | global |
6868
| [`macro`](@ref) | local (hard) | global |
6969
| [`for`](@ref), [`while`](@ref), [`try`](@ref try) | local (soft) | global, local |
7070
| [`function`](@ref), [`do`](@ref), [`let`](@ref), [comprehensions](@ref man-comprehensions), [generators](@ref man-generators) | local (hard) | global, local |
@@ -169,10 +169,10 @@ that location:
169169
1. **Existing local:** If `x` is *already a local variable*, then the existing local `x` is
170170
assigned;
171171
2. **Hard scope:** If `x` is *not already a local variable* and assignment occurs inside of any
172-
hard scope construct (i.e. within a `let` block, function or macro body, comprehension, or
172+
hard scope construct (i.e. within a `let` block, function, struct or macro body, comprehension, or
173173
generator), a new local named `x` is created in the scope of the assignment;
174174
3. **Soft scope:** If `x` is *not already a local variable* and all of the scope constructs
175-
containing the assignment are soft scopes (loops, `try`/`catch` blocks, or `struct` blocks), the
175+
containing the assignment are soft scopes (loops, `try`/`catch` blocks), the
176176
behavior depends on whether the global variable `x` is defined:
177177
* if global `x` is *undefined*, a new local named `x` is created in the scope of the
178178
assignment;

0 commit comments

Comments
 (0)