Nix Evaluation Performance: Difference between revisions
imported>Sternenseemann m Fix "Hello ${name}" desugaring |
imported>Infinisil Correct mistaken explanation regarding referenced variables; Nix wouldn't evaluate the original expression multiple times if variables were to create new thunks |
||
| Line 27: | Line 27: | ||
# Nix won't create thunks for referenced variables | # Nix won't create thunks for referenced variables | ||
#: This means that once you defined a variable in a <code>let in</code> expression, or you're in a function that received some arguments at the top, Nix won't create extra thunks for when you reference these variables. | #: This means that once you defined a variable in a <code>let in</code> expression, or you're in a function that received some arguments at the top, Nix won't create extra thunks for when you reference these variables. | ||
#: | #: It makes a lot of sense for Nix to do this, because variables themselves already point to either a thunk or an evaluated value, which can be used directly and doesn't need to be wrapped in another thunk that would just say "Evaluate this variable". | ||
# The following expressions attempt to create thunks if allowed by above two rules | # The following expressions attempt to create thunks if allowed by above two rules | ||