make it easy to switch different assertions on and off
sellout opened this issue · 1 comments
It's common to want to turn off postcondition (and maybe invariant) checks for third-party libraries. It should be easy for developers to control what is enabled on a per-package or per-asdf-system basis. Creating WITH-CONTRACTS-ENABLED
to use around LOAD
and adding in hooks to make it easy to use with ASDF.
We also have to make it easy to use big switches, to distinguish in-development from production, and any other arbitrary situations the developer may want different handling for.
As of b276916, you can now wrap arbitrary code in WITH-CONTRACTS-ENABLED
or -DISABLED
.
(with-contracts-disabled ()
(asdf:load-system :some-system))
will disable contracts for all classes and functions in that system. And
(with-contracts-disabled ()
(some-contracted-method ...)
...)
will disable them for any calls that happen within.
However, I think the semantics of what is disabled when are probably a bit off, and there's still no way to control this at the system or application level, so there's still more to do.