diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2022-12-02 09:00:03 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2022-12-02 09:14:12 -0500 |
commit | 19c53949714ffc6bf0e5d78aa6dd94cae2febc22 (patch) | |
tree | 807878e879f4ce085cf35953e7a0545843979663 /.github/ISSUE_TEMPLATE/bug_report.md | |
parent | ca42068bdc26108cfbd9f7db8af03730bc66d13a (diff) |
Change "while evaluating <fun>" to "while *calling*" in trace
The old way was not correct.
Here is an example:
```
$ nix-instantiate --eval --expr 'let x = a: throw "asdf"; in x 1' --show-trace
error: asdf
… while evaluating 'x'
at «string»:1:9:
1| let x = a: throw "asdf"; in x 1
| ^
… from call site
at «string»:1:29:
1| let x = a: throw "asdf"; in x 1
| ^
```
and yet also:
```
$ nix-instantiate --eval --expr 'let x = a: throw "asdf"; in x' --show-trace
<LAMBDA>
```
Here is the thing: in both cases we are evaluating `x`!
Nix is a higher-order languages, and functions are a sort of value. When
we write `x = a: ...`, `a: ...` is the expression that `x` is being
defined to be, and that is already a value. Therefore, we should *never*
get an trace that says "while evaluating `x`", because evaluating `a:
...` is *trival* and nothing happens during it!
What is actually happening here is we are applying `x` and evaluating
its *body* with arguments substituted for parameters. I think the
simplest way to say is just "while *calling* `x`", and so that is what I
changed it to.
Diffstat (limited to '.github/ISSUE_TEMPLATE/bug_report.md')
0 files changed, 0 insertions, 0 deletions