Skip to content

Commit 329a0dc

Browse files
committed
doc: clarify the documentation of Assume
1 parent 223fc24 commit 329a0dc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/developer-notes.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,10 @@ other input.
460460
safely continue even if the assumption is violated. In debug builds it
461461
behaves like `Assert`/`assert` to notify developers and testers about
462462
nonfatal errors. In production it doesn't warn or log anything, though the
463-
expression is always evaluated.
463+
expression is always evaluated. However, if the compiler can prove that
464+
an expression inside `Assume` is side-effect-free, it may optimize the call away,
465+
skipping its evaluation in production. This enables a lower-cost way of
466+
making explicit statements about the code, aiding review.
464467
- For example it can be assumed that a variable is only initialized once,
465468
but a failed assumption does not result in a fatal bug. A failed
466469
assumption may or may not result in a slightly degraded user experience,

0 commit comments

Comments
 (0)