[plt-scheme] Graphs

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Feb 8 21:05:07 EST 2005

On Feb 8, 2005, at 8:51 PM, Guillaume Marceau wrote:

> On Tue, 2005-02-08 at 16:05 -0500, Matthias Felleisen wrote:
>> On Feb 8, 2005, at 3:35 PM, Robby Findler wrote:
>>> I've tried to make contracts fill most of this need. I can see why 
>>> you
>>> might still want it occasionally, but most of the time you'd rather
>>> have blame attached, so would rather use a contract, imo.
>> However, a _good_ assert macro for Scheme (and I haven't seen one that
>> fills Schemers needs, though I have seen plenty that fills the need of
>> C programmers who like parentheses) would have to deal with the same
>> issues that Robby figured out for his dissertation.
> I've used the contract library quite a bit. The code for mztake is 
> lined
> with contracts, for instance.
> High-order contracts are by far the most useful useful feature of the
> library. This is in contrast with the blame annotations, which I could
> do entirely without.
> So far, I *never* used the blame annotations to discover the cause of
> the bug. As a consequence, I've become quite lax with my usage of 
> blame.
> I have the following definition:
>    (define (contract* c v) (contract c v 'unknown-blame 
> 'unknown-blame))
> CONTRACT* is the ASSERT function Matthias used in his example. I can 
> use
> CONTRACT* to wrap any value with a high-order contract, anywhere in the
> middle of the code. I found that the added flexibility more than make 
> up
> for the lack of blame annotations, which I wasn't using anyway.

I don't quite understand this. provide/contract synthesizes blame for 
you, and the above is broken to start with. Robby should never have 
provided this.

> I suppose if I was writing larger software with many people on the 
> team,
> blame annotations would become much more useful. But not at the scale
> I'm working at.
> On the other hand, high-order contracts are useful for me now. They're
> just great.

This confirms almost everything I conjecture about contracts and 
assertions. I tend to use many modules (10 so far on my current 3,500 
line program) and thus simulate multi-programmer teams. When I 
integrated for the first time contracts discovered three out of four 
bugs and blamed the proper module (though sadly I never believed them 

Note our hunch is that if you have a typed language, people won't use 
contracts unless there is blame. If just one component uses blame 
properly, the rest of the programmers are forced to use them because 
otherwise they get blamed :-)

-- Matthias

Posted on the users mailing list.