[master] 3e1a23545 doc: Document status quo regarding == and != operator behavior
Nils Goroll
nils.goroll at uplex.de
Tue Dec 2 10:05:04 UTC 2025
commit 3e1a235457965442efecf3eb393aa597ebf476f9
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Tue Dec 2 11:02:13 2025 +0100
doc: Document status quo regarding == and != operator behavior
diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst
index aae98629e..4814bc92d 100644
--- a/doc/sphinx/reference/vcl.rst
+++ b/doc/sphinx/reference/vcl.rst
@@ -103,6 +103,27 @@ The following operators are available in VCL:
``&&`` / ``||``
Logical and/or.
+On Equality
+~~~~~~~~~~~
+
+In this section, "compare equal" means that the ``==`` operator returns ``true``
+and, conversely, the ``!=`` operator returns ``false``.
+
+The VCL types ``INT``, ``DURATION``, ``BYTES``, ``REAL`` and ``TIME`` compare
+equal if their values compare equal numerically.
+
+Notice that ``DURATION``, ``REAL`` and ``TIME`` are represented as floating
+point numbers, and hence testing for (in)equality might be unreliable.
+
+``IP`` compares equal for equal address.
+
+``STRING`` and ``STRANDS`` compare equal if the represented strings are equal.
+
+``BOOL`` compares equal if the truth value is the same.
+
+The VCL types ``BACKEND``, ``ACL``, ``PROBE``, ``STEVEDORE``, ``SUB`` and
+``INSTANCE`` compare equal if they represent the same object. Different objects
+with the same properties will never compare equal.
Conditionals
------------
More information about the varnish-commit
mailing list