mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-11-27 15:01:22 +08:00
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:
parent
c7d81b20a0
commit
1aeb2f6e98
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user