[plt-scheme] Disabling contract checking
Let me cite Tony Hoare and older and wiser authority than myself:
Imagine yourself learning how to run an ocean-going sail-boat.
Of course, you start with exercises on land. You wear your
life vest, too. When you're ready, you take the sailboat out
on the ocean, and to avoid the weight, you leave the life
vests behind on land. That's what it means to run code with
contracts [he said "assertions"] turned off.
[I heard him say this at some POPL, but he has written it
down somewhere, too. For all I know he just repeated it at
POPL.]
;; ---
Having said that, I can see turning off the _positive_ positions
after you have tested, on a per module basis. The _negative_ ones
check whether your clients take you seriously.
;; ---
We are always interested in examples where module contracts impose
such a heavy overhead that it is impossible to work with them when
the module is deployed.
-- Matthias
On Apr 10, 2006, at 2:06 PM, Lauri Alanko wrote:
> Contracts, though stupendously expressive, are still essentially just
> "assert" on steroids. However, the reason why assertions are so
> ubiquitously popular is that they can be disabled in production code,
> removing all overhead. But am I blind, or is there really no such
> option
> for contract.ss? Why?
>
> I know that the theory is that contracts are placed only on
> inter-module
> boundaries, and that inter-module boundaries are not crossed too often,
> but neither of these is always true, so the unability to disable
> contracts discourages one from placing precise contracts on
> performance-critical functions. This seems like a shame.
>
> What, in any case, would be the proper way to implement a compile-time
> option such as this? A transformation-time parameter value? Or perhaps
> a
> custom classloader that provides an alternate version of a
> macro-defining module?
>
>
> Lauri
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme