[racket-dev] Blame and re-provided bindings

From: Casey Klein (clklein at eecs.northwestern.edu)
Date: Fri Jan 14 14:40:17 EST 2011

The new, nicely formatted blame messages helped me discover that every
single Redex contract has the wrong negative party. (Admittedly, the
commonly used Redex provides are macros.) There are two problems.

I believe the first is a bug. The following program (module
dependencies DAG: http://pastebin.com/u9KMTnuP) blames d.rkt, even
though the abused function never passes through its hands.

a.rkt:
#lang racket
(require "b.rkt")
(f 3.5)

b.rkt:
#lang racket
(require "c.rkt" "d.rkt")
(provide (all-from-out "c.rkt"))

c.rkt:
#lang racket
(require "e.rkt")
(provide/contract
 [f (-> integer? integer?)])

d.rkt:
#lang racket
(require "c.rkt")

e.rkt:
#lang racket
(define (f x) x)
(provide f)

The second problem is that, AFAIK, there's no convenient way to define
a module b that combines the provides of two modules c and d. If b
requires c and d and provides values f and g using `all-from-out',
then b, not the module that requires it, becomes the negative party on
the f and g contracts.

a.rkt:
#lang racket
(require "b.rkt")
(f 3.5)

b.rkt:
#lang racket
(require "c.rkt" "d.rkt")
(provide (all-from-out "c.rkt" "d.rkt"))

c.rkt:
#lang racket
(define (f x) x)
(provide/contract
 [f (-> integer? integer?)])

d.rkt:
#lang racket
(define (g x) x)
(provide/contract
 [g (-> string? string?)])


Posted on the dev mailing list.