Open
Milestone
-noassert
The ocaml compiler has a -noassert flag. This flag is used to remove the assertion checks (assert <expr>, but not assert false) from the code.
The Option can have a significant impact on performance in case the expression is non-trivial (e.g., assert (List.for_all2 ( <= ) a b)). Thus, the option is often used when compiling ocaml project to production.
The Option can also have a significant impact on semantics. Thus, we cannot simply switch it on.
Things to do:
- Survey uses of the
assertfunction (not theassert falseexpression) in the production code (i.e., excluding the tests and the dev tools and such). - Decide on and document a policy for acceptable use of
assertsuch that it is ok to use-noassert. - Convert contravening uses to use a different exception.
- Advertise the new policy (to the devteam and to the mergeteam).
- Switch on the option for production binaries.
Loading
Loading
Loading
Loading