Skip to content

Commit

Permalink
docs: Note that tryEval doesn't do deep evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
infinisil committed Sep 3, 2019
1 parent 84de821 commit e4ea3e0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions doc/manual/expressions/builtins.xml
Expand Up @@ -1607,12 +1607,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>
Expand Down

0 comments on commit e4ea3e0

Please sign in to comment.