From 7c9ad4d0d7bbd3896c99fa0b252d21a69e18b711 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Tue, 3 Sep 2019 07:32:44 +0200 Subject: docs: Note that tryEval doesn't do deep evaluation (cherry picked from commit e4ea3e03066a760c8cd462108af99aebaaa44c1b) --- doc/manual/expressions/builtins.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'doc/manual/expressions/builtins.xml') 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 { builtins.tryEval e - Try to evaluate e. + Try to shallowly evaluate e. Return a set containing the attributes success (true if e evaluated successfully, false if an error was thrown) and value, equalling e - if successful and false otherwise. + if successful and false otherwise. Note that this + doesn't evaluate e deeply, so + let e = { x = throw ""; }; in (builtins.tryEval e).success + will be true. Using builtins.deepSeq + one can get the expected result: let e = { x = throw ""; + }; in (builtins.tryEval (builtins.deepSeq e e)).success will be + false. -- cgit 1.4.1