[plt-scheme] Graphs

From: Guillaume Marceau (gmarceau at cs.brown.edu)
Date: Tue Feb 8 20:51:01 EST 2005

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.
> [If you're wondering, here is an example:
>   (define (g k)
>    (let ([f (ASSERT (positive? . -> . positive?) (lambda (x) ... k ...)])
>      (f ..)
>      ...
>      f)
> ]

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 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. 

"The thing I remember most about America is that it's silly.
 That can be quite a relief at times."  -- Thom Yorke, Radiohead

- Guillaume

Posted on the users mailing list.