# Stability of function return values in Nix

**URL:** https://discourse.nixosstag.fcio.net/t/stability-of-function-return-values-in-nix/45124
**Category:** Nix
**Created:** [May 9, 2024, 7:20am UTC](https://discourse.nixosstag.fcio.net/t/stability-of-function-return-values-in-nix/45124 "2024-05-09T07:20:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![physics-enthusiast](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/physics-enthusiast/32/17093_2.png) [@physics-enthusiast](https://discourse.nixosstag.fcio.net/u/physics-enthusiast)
#### Post date: [May 9, 2024, 7:20am UTC](https://discourse.nixosstag.fcio.net/t/stability-of-function-return-values-in-nix/45124/1 "2024-05-09T07:20:38Z")

</div>

Seeking opinions from the community since I can’t seem to find any documentation on this. Is there an official guarantee or implicit understanding that “pure-nix” function return values are absolutely stable? Say I implemented a builtin that tracks all calls to `import` made during the process of evaluating some expression (let’s just assume for now that the specification of said expression itself creates no ambiguities and causes no complications, so that we may focus on the _evaluation_ of the expression after it is specified). If the laziness behaviour of Nix changes (for instance if [this](https://github.com/NixOS/nix/issues/4090) gets merged) and hence the set of `imports` that actually get evaluated shrinks, would the presence of this function make that a breaking change? Would it constitute one on its own?  
Related:

> [@Pre-RFC: Implement dependency retrieval primitive](https://discourse.nixosstag.fcio.net/t/pre-rfc-implement-dependency-retrieval-primitive/43418):
>
> Summary Expand the dependency tracking system with 3 new primops getRunDeps, getBuildDeps and getInstantiationDeps. Motivation Currently, the task of obtaining a complete list of the dependencies of a given derivation is (IMO) needlessly difficult. Existing tools to achieve this like exportReferencesGraph are both poorly documented and insufficiently granular, leading to persistent difficulties in usefully ‘transmitting’ the results of derivations to resource-constrained machines. In particu…

which I am in the earliest stages of attempting a draft implementation of.  
Pinging @RaitoBezarius since he brought up primop stability in the discussion of that pre-RFC.

---

<div class="post-metadata">

### Author: ![roberth](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/roberth/32/5488_2.png) [@roberth](https://discourse.nixosstag.fcio.net/u/roberth)
#### Post date: [May 13, 2024, 2:43pm UTC](https://discourse.nixosstag.fcio.net/t/stability-of-function-return-values-in-nix/45124/2 "2024-05-13T14:43:48Z")

</div>

That’s a gap in the Nix manual, so I’ve opened [Stability promise, reprodubility properties · Issue #10694 · NixOS/nix · GitHub](https://github.com/NixOS/nix/issues/10694) for now.  
I believe it also answers your question. I don’t think improved laziness should be considered a breaking change, unless more is going on.
