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

docs: fix scope type of a struct to hard #56755

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Changes from 1 commit
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
Next Next commit
change struct scope to hard in documentation
  • Loading branch information
ArnoStrouwen committed Dec 5, 2024
commit d0f1a6546775f91eb7665fafdda12fae63ba038b
6 changes: 3 additions & 3 deletions doc/src/manual/variables-and-scoping.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The constructs introducing scope blocks are:
| Construct | Scope Type Introduced | Scope Types Able to Contain Construct |
|:----------|:----------------------|:--------------------------------------|
| [`module`](@ref), [`baremodule`](@ref) | global | global |
| [`struct`](@ref) | local (soft) | global |
| [`struct`](@ref) | local (hard) | global |
| [`macro`](@ref) | local (hard) | global |
| [`for`](@ref), [`while`](@ref), [`try`](@ref try) | local (soft) | global, local |
| [`function`](@ref), [`do`](@ref), [`let`](@ref), [comprehensions](@ref man-comprehensions), [generators](@ref man-generators) | local (hard) | global, local |
Expand Down Expand Up @@ -169,10 +169,10 @@ that location:
1. **Existing local:** If `x` is *already a local variable*, then the existing local `x` is
assigned;
2. **Hard scope:** If `x` is *not already a local variable* and assignment occurs inside of any
hard scope construct (i.e. within a `let` block, function or macro body, comprehension, or
hard scope construct (i.e. within a `let` block, function, struct or macro body, comprehension, or
generator), a new local named `x` is created in the scope of the assignment;
3. **Soft scope:** If `x` is *not already a local variable* and all of the scope constructs
containing the assignment are soft scopes (loops, `try`/`catch` blocks, or `struct` blocks), the
containing the assignment are soft scopes (loops, `try`/`catch` blocks), the
behavior depends on whether the global variable `x` is defined:
* if global `x` is *undefined*, a new local named `x` is created in the scope of the
assignment;
Expand Down
Loading