pkg/eval: Link to the upvalue explanation from the doc of "eval".

Also make the upvalue explanation its own subsection.
This commit is contained in:
Qi Xiao 2024-05-02 21:00:35 +01:00
parent c7d81b20a0
commit 1aeb2f6e98
2 changed files with 7 additions and 3 deletions

View File

@ -93,7 +93,8 @@ fn resolve {|command| }
# the variables may be mutated by `$code`.
#
# If the `&ns` option is `$nil` (the default), a temporary namespace built by
# amalgamating the local and upvalue scopes of the caller is used.
# amalgamating the local and [upvalue scopes](language.html#upvalues) of the
# caller is used.
#
# If `$code` fails to parse or compile, the parse error or compilation error is
# raised as an exception.

View File

@ -807,7 +807,9 @@ referring to a local variable `$n`. Closure semantics means that:
▶ 1
```
Variables that get "captured" in closures are called **upvalues**;. When
### Upvalues
Variables that get "captured" in closures are called **upvalues**. When
capturing upvalues, Elvish only captures the variables that are used. In the
following example, `$m` is not an upvalue of `$g` because it is not used:
@ -816,7 +818,8 @@ following example, `$m` is not an upvalue of `$g` because it is not used:
~> var g = (f)
```
**Note**: This effect has impacts on the [`eval`](builtin.html#eval) command.
**Note**: The effect of this behavior is usually not noticeable, but has impacts
on the [`eval`](builtin.html#eval) command.
# Expressions