about summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2019-09-03T05·32+0200
committerEelco Dolstra <edolstra@gmail.com>2019-10-09T14·25+0200
commit7c9ad4d0d7bbd3896c99fa0b252d21a69e18b711 (patch)
treec68fa88cfc3dfde0ed0859a4ba68a8755d880272 /doc
parentfa028194e9e707e7aa35990e074f5c6672b50f98 (diff)
docs: Note that tryEval doesn't do deep evaluation
(cherry picked from commit e4ea3e03066a760c8cd462108af99aebaaa44c1b)
Diffstat (limited to 'doc')
-rw-r--r--doc/manual/expressions/builtins.xml10
1 files changed, 8 insertions, 2 deletions
diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml
index ffede99c5841..465fa1e0b001 100644
--- a/doc/manual/expressions/builtins.xml
+++ b/doc/manual/expressions/builtins.xml
@@ -1605,12 +1605,18 @@ stdenv.mkDerivation (rec {
     <term><function>builtins.tryEval</function>
     <replaceable>e</replaceable></term>
 
-    <listitem><para>Try to evaluate <replaceable>e</replaceable>.
+    <listitem><para>Try to shallowly evaluate <replaceable>e</replaceable>.
     Return a set containing the attributes <literal>success</literal>
     (<literal>true</literal> if <replaceable>e</replaceable> evaluated
     successfully, <literal>false</literal> if an error was thrown) and
     <literal>value</literal>, equalling <replaceable>e</replaceable>
-    if successful and <literal>false</literal> otherwise.
+    if successful and <literal>false</literal> otherwise. Note that this
+    doesn't evaluate <replaceable>e</replaceable> deeply, so
+    <literal>let e = { x = throw ""; }; in (builtins.tryEval e).success
+    </literal> will be <literal>true</literal>. Using <literal>builtins.deepSeq
+    </literal> one can get the expected result: <literal>let e = { x = throw "";
+    }; in (builtins.tryEval (builtins.deepSeq e e)).success</literal> will be
+    <literal>false</literal>.
     </para></listitem>
 
   </varlistentry>