mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
evaluate inherit (from) exprs only once per directive
desugaring inherit-from to syntactic duplication of the source expr also duplicates side effects of the source expr (such as trace calls) and expensive computations (such as derivationStrict).
This commit is contained in:
parent
ecf8b12d60
commit
cefd0302b5
9 changed files with 109 additions and 15 deletions
7
doc/manual/rl-next/inherit-from-by-need.md
Normal file
7
doc/manual/rl-next/inherit-from-by-need.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
synopsis: "`inherit (x) ...` evaluates `x` only once"
|
||||
prs: 9847
|
||||
---
|
||||
|
||||
`inherit (x) a b ...` now evaluates the expression `x` only once for all inherited attributes rather than once for each inherited attribute.
|
||||
This does not usually have a measurable impact, but side-effects (such as `builtins.trace`) would be duplicated and expensive expressions (such as derivations) could cause a measurable slowdown.
|
Loading…
Add table
Add a link
Reference in a new issue