From 2f2a20ed18535ba819225fabe9a4cf2f37d2edb1 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Mon, 10 Mar 2014 07:09:07 -0400 Subject: Document null dynamic attrs --- doc/manual/release-notes.xml | 5 ++++- doc/manual/writing-nix-expressions.xml | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/manual/release-notes.xml b/doc/manual/release-notes.xml index 56f7bd65490d..44762d1d6c8a 100644 --- a/doc/manual/release-notes.xml +++ b/doc/manual/release-notes.xml @@ -25,7 +25,10 @@ attribute names (e.g. set."${foo}"). In the case where the attribute name is just a single antiquotation, the quotes can be dropped (e.g. the above example can be written - set.${foo}). + set.${foo}). If an attribute name inside of a + set declaration evaluates to "${null}" (e.g. + { ${null} = false; }), then that attribute is not added + added to the set. diff --git a/doc/manual/writing-nix-expressions.xml b/doc/manual/writing-nix-expressions.xml index 71cd84b072b4..873dc21a5292 100644 --- a/doc/manual/writing-nix-expressions.xml +++ b/doc/manual/writing-nix-expressions.xml @@ -871,6 +871,17 @@ This will evaluate to 123 if coerced to a string and 456 otherwise (again assuming bar is antiquotable). +In the special case where an attribute name inside of a set declaration +evaluates to "${null}" (which is normally an error, as +null is not antiquotable), that attribute is simply not +added to the set: + + +{ ${if foo then "bar" else null} = true; } + +This will evaluate to {} if foo +evaluates to false. + -- cgit 1.4.1