diff --git a/doc/manual/release-notes.xml b/doc/manual/release-notes.xml index 37bb730f40..56f7bd6549 100644 --- a/doc/manual/release-notes.xml +++ b/doc/manual/release-notes.xml @@ -21,6 +21,12 @@ nix-setuid-helper is gone. + Now antiquotation is allowed inside of quoted + 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}). + diff --git a/doc/manual/writing-nix-expressions.xml b/doc/manual/writing-nix-expressions.xml index c5b355ea04..71cd84b072 100644 --- a/doc/manual/writing-nix-expressions.xml +++ b/doc/manual/writing-nix-expressions.xml @@ -851,13 +851,26 @@ default value in an attribute selection using the will evaluate to "Xyzzy" because there is no c attribute in the set. -You can use arbitrary string constants as attribute names by -enclosing them in quotes: +You can use arbitrary double-quoted strings as attribute +names: -{ "foo bar" = 123; "nix-1.0" = 456; }."foo bar" +{ "foo ${bar}" = 123; "nix-1.0" = 456; }."foo ${bar}" + + +This will evaluate to 123 (Assuming +bar is antiquotable). In the case where an +attribute name is just a single antiquotation, the quotes can be +dropped: + + +{ foo = 123; }.${bar} or 456 + +This will evaluate to 123 if +bar evaluates to "foo" when +coerced to a string and 456 otherwise (again +assuming bar is antiquotable). -This will evaluate to 123.