about summary refs log tree commit diff
path: root/doc/manual/writing-nix-expressions.xml
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2014-01-22T00·33+0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-26T13·06+0100
commit733214144a7a910001c1c82683db780853bac9b1 (patch)
treeee875c5888232ecc42b2ac6045a4725ce82b481c /doc/manual/writing-nix-expressions.xml
parent42eb4afd7a38f3024a66da037d9f39859f7bd8f3 (diff)
Document dynamic attributes
Signed-off-by: Shea Levy <shea@shealevy.com>
Diffstat (limited to 'doc/manual/writing-nix-expressions.xml')
-rw-r--r--doc/manual/writing-nix-expressions.xml21
1 files changed, 17 insertions, 4 deletions
diff --git a/doc/manual/writing-nix-expressions.xml b/doc/manual/writing-nix-expressions.xml
index c5b355ea0469..71cd84b072b4 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 <literal>"Xyzzy"</literal> because there is no
 <varname>c</varname> attribute in the set.</para>
 
-<para>You can use arbitrary string constants as attribute names by
-enclosing them in quotes:
+<para>You can use arbitrary double-quoted strings as attribute
+names:
 
 <programlisting>
-{ "foo bar" = 123; "nix-1.0" = 456; }."foo bar" </programlisting>
+{ "foo ${bar}" = 123; "nix-1.0" = 456; }."foo ${bar}"
+</programlisting>
+
+This will evaluate to <literal>123</literal> (Assuming
+<literal>bar</literal> is antiquotable). In the case where an
+attribute name is just a single antiquotation, the quotes can be
+dropped:
+
+<programlisting>
+{ foo = 123; }.${bar} or 456 </programlisting>
+
+This will evaluate to <literal>123</literal> if
+<literal>bar</literal> evaluates to <literal>"foo"</literal> when
+coerced to a string and <literal>456</literal> otherwise (again
+assuming <literal>bar</literal> is antiquotable).</para>
 
-This will evaluate to <literal>123</literal>.</para>
 
 </simplesect>