Hello,
I noticed that Andres recently introduced pg_assume into the codebase - great addition!
That got me thinking: some projects (like PHP) map the ASSERT macro to ASSUME in non-assert builds. The rationale is
thatASSERT typically expresses a tautology, something the programmer believes to be always true. So in builds where
assertionsare compiled out, we can still pass that information to the optimizer via ASSUME.
This approach has the advantage of keeping the semantics consistent: developers write ASSERT(...) as usual, and the
compilereither enforces it at runtime (assert builds) or uses it as a hint (non-assert builds). There's no need to
writeseparate logic or macros depending on build type. And we get the benefits of both safety and optimization.
Was this strategy considered before introducing pg_assume, or did I miss that part of the discussion?
Cheers
--
Benjamin Coutu
http://www.zeyos.com