[master] 1b80bb8 Document "math first, then string conversion"

Geoff Simmons geoff at uplex.de
Tue Mar 14 15:41:06 CET 2017


commit 1b80bb8589bbe60f47272bf1ad15d9f3e47f49fa
Author: Geoff Simmons <geoff at uplex.de>
Date:   Tue Mar 14 15:39:50 2017 +0100

    Document "math first, then string conversion"

diff --git a/doc/sphinx/whats-new/upgrading-5.1.rst b/doc/sphinx/whats-new/upgrading-5.1.rst
index ab99260..e3bc039 100644
--- a/doc/sphinx/whats-new/upgrading-5.1.rst
+++ b/doc/sphinx/whats-new/upgrading-5.1.rst
@@ -97,7 +97,10 @@ To summarize:
 
 * If both operands of ``+`` or ``-`` are one of BYTES, DURATION, INT
   or REAL, then the result has the same data type, with the obvious
-  numeric interpretation.
+  numeric interpretation. If such an expression is evaluated in a
+  context that expects a STRING (for example for assignment to a
+  header), then the arithmetic is done first, and the result it
+  converted to a STRING.
 
 * INTs and REALs can be added or subtracted to yield a REAL.
 
@@ -106,9 +109,9 @@ To summarize:
 
 * No other combinations of operand types are legal with ``-``.
 
-* If an expression with ``+`` is evaluated in a context where a STRING
-  is expected, then for all other combinations of operand data types,
-  the operands are converted to STRINGs and concatenated.
+* When a ``+`` expression is evaluated in a STRING context, then for
+  all other combinations of operand data types, the operands are
+  converted to STRINGs and concatenated.
 
 * If a STRING is not expected for the ``+`` expression, then no other
   combination of data types is legal.



More information about the varnish-commit mailing list