mirror of
https://github.com/NixOS/nix.dev.git
synced 2024-10-18 14:32:43 -04:00
rephrase best practices for clarity
This commit is contained in:
parent
3f5c86d466
commit
b1ae5e47fc
|
@ -31,10 +31,8 @@ rec {
|
|||
{ a = 1; b = 3; }
|
||||
```
|
||||
|
||||
There are a couple of pitfalls:
|
||||
|
||||
- It's possible to introduce a hard to debug error `infinite recursion` when shadowing a name, the simplest example being `let b = 1; a = rec { b = b; }; in a`.
|
||||
- Combining with overriding logic such as the [`overrideAttrs`](https://nixos.org/manual/nixpkgs/stable/#sec-pkg-overrideAttrs) function in {term}`Nixpkgs` has a surprising behaviour of not overriding every reference.
|
||||
A common pitfall is to introduce a hard to debug error `infinite recursion` when shadowing a name.
|
||||
The simplest example for this is: `let a = 1; in rec { a = a; }`.
|
||||
|
||||
:::{tip}
|
||||
Avoid `rec`. Use `let ... in`.
|
||||
|
|
Loading…
Reference in a new issue