[plt-scheme] Contracts on Libraries

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Sat May 26 14:42:27 EDT 2007

I concur: contracts are a good thing.  They're helpful for bug-finding
at all stages of development. As long as you don't put a linear-time
contract on a log-time operation (or something similar), efficiency
shouldn't be too bad.  Scheme already has safety checks on many
operations; as far as I'm concerned adding new checks to new
operations is just standard overhead.

If you have a really speed-sensitive library, you could always expose
both the contracted and uncontracted modules and let users choose.
Personally, I wouldn't worry about it for 99.99% of planet libraries.


On 5/26/07, Chongkai Zhu <czhu at cs.utah.edu> wrote:
> I agree with you and quite many people do the same thing. I can't see any significant efficiency difference between using contracts and user code.
> Chongkai
> ----- Original Message -----
> From: "Paulo J. Matos" <pocm at soton.ac.uk>
> To: <plt-scheme at list.cs.brown.edu>
> Sent: Saturday, May 26, 2007 10:39 AM
> Subject: [plt-scheme] Contracts on Libraries
> > Hello all,
> >
> > I'd like some comments on addings contracts to libraries. I'm
> > developing a graph library, soon on planet, which on the interface
> > module contains contracts on the functions the user might access.
> > In my opinion this is good because it allows me to separate the code
> > doing real stuff and the checks (does the function receive a struct
> > and blablabla). However, I'd like to know if people agree with the use
> > of contracts on libraries or if for efficiency reasons (or any other),
> > think that no contracts should be used and that they should only
> > appear on user code.
> >
> > Cheers,
> >
> > --
> > Paulo Jorge Matos - pocm at soton.ac.uk
> > http://www.personal.soton.ac.uk/pocm
> > PhD Student @ ECS
> > University of Southampton, UK

Posted on the users mailing list.