diff options
author | Valentin Gagarin <valentin.gagarin@tweag.io> | 2022-12-22 22:11:17 +0100 |
---|---|---|
committer | Valentin Gagarin <valentin.gagarin@tweag.io> | 2023-01-05 14:15:01 +0100 |
commit | 969e5ad5bfc6527b8205182e50ba4ec216f218a0 (patch) | |
tree | 37417470378943e9bda068a20dbd70405c4a3241 /doc/manual | |
parent | 63b640e0c224fb959396f287b0db0c746a06c747 (diff) |
add semantics of overloaded `+` operator
Diffstat (limited to 'doc/manual')
-rw-r--r-- | doc/manual/src/language/operators.md | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/doc/manual/src/language/operators.md b/doc/manual/src/language/operators.md index e3a00d32b..0c8cc6f57 100644 --- a/doc/manual/src/language/operators.md +++ b/doc/manual/src/language/operators.md @@ -70,21 +70,21 @@ Associativity: left Precedence: 6 -## Addition +## Subtraction -> *e1* `+` *e2* +> *e1* `-` *e2* -Add numbers *e1* and *e2*. +Subtract numbers *e2* from *e1*. Associativity: left Precedence: 7 -## Subtraction +## Addition -> *e1* `-` *e2* +> *e1* `+` *e2* -Subtract numbers *e2* from *e1*. +Add numbers *e1* and *e2*. Associativity: left @@ -100,6 +100,44 @@ Associativity: left Precedence: 7 +## Path concatenation + +> *path1* `+` *path2* + +Concatenate two paths. +The result is a path. + +## Path and string concatenation + +> *path* `+` *string* + +Concatenate *path* with *string*. +The result is a path. + +> **Note** +> +> The string must not have a string context that refers to a store path. + +Associativity: left + +Precedence: 7 + +## String and path concatenation + +> *string* `+` *path* + +Concatenate *string* with *path*. +The result is a string. + +> **Important** +> +> The file or directory at *path* must exist and is copied to the store +> The path appears in the result as the corresponding store path. + +Associativity: left + +Precedence: 7 + ## Logical negation (`NOT`) > `!` *e* |