From e5c499b833a329876649f7efc1cbdc7b9a64092c Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Thu, 26 Oct 2017 18:49:26 +0000 Subject: [PATCH 1/3] Describe arithmetic operators --- doc/manual/expressions/language-operators.xml | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/doc/manual/expressions/language-operators.xml b/doc/manual/expressions/language-operators.xml index a3323ced4..f1f750934 100644 --- a/doc/manual/expressions/language-operators.xml +++ b/doc/manual/expressions/language-operators.xml @@ -40,6 +40,11 @@ weakest binding). Call function e1 with argument e2. + + - e + none + Arithmetic negation. + e ? attrpath @@ -55,13 +60,24 @@ weakest binding). List concatenation. - e1 + e2 + + e1 * e2, + e1 / e2 + left - String or path concatenation. + Arithmetic multiplication and division. + + + + e1 + e2, + e1 - e2 + + left + Arithmetic addition and subtraction. String or path concatenation (only by +). ! e - left + none Boolean negation. @@ -75,16 +91,22 @@ weakest binding). attributes). - e1 == - e2 + + e1 < e2, + e1 > e2, + e1 <= e2, + e1 >= e2 + none - Equality. + Arithmetic comparison. - e1 != - e2 + + e1 == e2, + e1 != e2 + none - Inequality. + Equality and inequality. e1 && From 15457c56731537e0d424d5feb3f3fcacba39b99b Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Thu, 26 Oct 2017 18:50:30 +0000 Subject: [PATCH 2/3] Describe "with" scoping precedence --- doc/manual/expressions/language-constructs.xml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/manual/expressions/language-constructs.xml b/doc/manual/expressions/language-constructs.xml index fe69dba83..2f0027d47 100644 --- a/doc/manual/expressions/language-constructs.xml +++ b/doc/manual/expressions/language-constructs.xml @@ -333,7 +333,20 @@ with (import ./definitions.nix); ... makes all attributes defined in the file definitions.nix available as if they were defined -locally in a rec-expression. +locally in a let-expression. + +The bindings introduced by with do not shadow bindings +introduced by other means, e.g. + + +let a = 3; in with { a = 1; }; let a = 4; in with { a = 2; }; ... + +establishes the same scope as + + +let a = 1; in let a = 2; in let a = 3; in let a = 4; in ... + + From 842ce8bafd89a896680d8614ffb2b08b6b38452a Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Thu, 26 Oct 2017 18:50:59 +0000 Subject: [PATCH 3/3] Clarify indented string escaping rules --- doc/manual/expressions/language-values.xml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/manual/expressions/language-values.xml b/doc/manual/expressions/language-values.xml index 67da688a4..bb2090c88 100644 --- a/doc/manual/expressions/language-values.xml +++ b/doc/manual/expressions/language-values.xml @@ -98,13 +98,17 @@ configureFlags = " Since ${ and '' have special meaning in indented strings, you need a way to quote them. - ${ can be escaped by prefixing it with + $ can be escaped by prefixing it with '' (that is, two single quotes), i.e., - ''${. '' can be escaped by + ''$. '' can be escaped by prefixing it with ', i.e., - '''. Finally, linefeed, carriage-return and - tab characters can be written as ''\n, - ''\r, ''\t. + '''. $ removes any special meaning + from the following $. Linefeed, carriage-return and tab + characters can be written as ''\n, + ''\r, ''\t, and ''\ + escapes any other character. + + Indented strings are primarily useful in that they allow multi-line string literals to follow the indentation of the