docs(tvix): fix minor spelling problems in pointer equality document

Main one is the its-it's mistake in the last paragraph, the rest was
suggested by LanguageTool.

Change-Id: If1b87a11f480452f312fc2759be7ded782d0a522
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7930
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
sterni 2023-01-25 15:16:16 +01:00 committed by clbot
parent 8a8325fb9d
commit daa3721f73

View file

@ -5,7 +5,7 @@
It is a piece of semi-obscure Nix trivia that while functions are generally not It is a piece of semi-obscure Nix trivia that while functions are generally not
comparable, they can be compared in certain situations. This is actually quite an comparable, they can be compared in certain situations. This is actually quite an
important fact, as it is essential for the evaluation of nixpkgs: The attribute sets important fact, as it is essential for the evaluation of nixpkgs: The attribute sets
used to represent platforms in nixpkgs, like `stdenv.buildPlatform`, contain functions, used to represent platforms in nixpkgs, like `stdenv.buildPlatform`, contain functions,
such as `stdenv.buildPlatform.canExecute`. When writing cross logic, one invariably such as `stdenv.buildPlatform.canExecute`. When writing cross logic, one invariably
ends up writing expressions that compare these sets, e.g. `stdenv.buildPlatform != ends up writing expressions that compare these sets, e.g. `stdenv.buildPlatform !=
stdenv.hostPlatform`. Since attribute set equality is the equality of their attribute stdenv.hostPlatform`. Since attribute set equality is the equality of their attribute
@ -46,7 +46,7 @@ So what is _actually_ going on?
## Nix (pointer) Equality in C++ Nix ## Nix (pointer) Equality in C++ Nix
TIP: The summary presented here is up to date as of 2022-11-23 and was tested with Nix 2.3 and 2.11. TIP: The summary presented here is up-to-date as of 2022-11-23 and was tested with Nix 2.3 and 2.11.
The function implementing equality in C++ Nix is `EvalState::eqValues` which starts with The function implementing equality in C++ Nix is `EvalState::eqValues` which starts with
[the following bit of code][eqValues-pointer-eq]: [the following bit of code][eqValues-pointer-eq]:
@ -79,7 +79,7 @@ In fact, we can also write our `pointerEqual` function as:
lhs: rhs: [ lhs ] == [ rhs ] lhs: rhs: [ lhs ] == [ rhs ]
``` ```
It's interesting that `EvalState::eqValues` forces the left and right hand value before trying pointer It's interesting that `EvalState::eqValues` forces the left and right-hand value before trying pointer
equality. It explains that `let x = throw ""; in x == x` does not evaluate successfully, but it is puzzling why equality. It explains that `let x = throw ""; in x == x` does not evaluate successfully, but it is puzzling why
`let f = x: x; in f == f` does not return `true`. In fact, why do we need to wrap the values in a list or `let f = x: x; in f == f` does not return `true`. In fact, why do we need to wrap the values in a list or
attribute set at all for our `pointerEqual` function to work? attribute set at all for our `pointerEqual` function to work?
@ -183,7 +183,7 @@ indicating that pointer comparison may be removed in the future.
Now, I can't speak for the upstream C++ Nix developers, but sure can speculate. Now, I can't speak for the upstream C++ Nix developers, but sure can speculate.
As already pointed out, this feature is currently needed for evaluating nixpkgs. As already pointed out, this feature is currently needed for evaluating nixpkgs.
While it's use could realistically be eliminated (only bothersome spot is probably While its use could realistically be eliminated (only bothersome spot is probably
the `emulator` function, but that should also be doable), removing the feature the `emulator` function, but that should also be doable), removing the feature
would seriously compromise C++ Nix's ability to evaluate historical nixpkgs would seriously compromise C++ Nix's ability to evaluate historical nixpkgs
revision which is arguably a strength of the system. revision which is arguably a strength of the system.