[racket-dev] [plt] Push #21701: master branch updated

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Dec 10 08:12:11 EST 2010

Okay. So I'll just start by spelling out the pieces of information
that's there to be put into a message:

 - is the contract blaming the party where the contract was written (or not)
 - the source location where the contract was written down
 - the contract, written out
 - the names of the two parties
 - a violation specific message with some details (ususally of the
form "expected an <integer?>, got #f" or similar)

The current error message uses that first thing as a conditional and
has a different sentence for each of those cases.

If someone besides me wants to take a stab at formulating a less
painful message, the code is in
collects/racket/contract/private/blame.rkt and, thanks to Stevie's
refactoring, very easy to work with.

Interesting test cases to try include using two modules with
provide/contract (examples blaming both), a define/contract that is
abused from the top of a module and a define/contract nested inside a


On Fri, Dec 10, 2010 at 7:00 AM, Eli Barzilay <eli at barzilay.org> wrote:
> 15 minutes ago, Robby Findler wrote:
>> Positive suggestions for improvement are welcome. Bad analogies that
>> don't help are like someone coming over to your house and hitting
>> you with hammer before you even get a chance to have some coffee.
> I didn't even intend for this to be a (bad) analogy -- the thing that
> makes it bad IMO is that the real meat (relevant source locations, the
> contract that was broken) are drowned in legal verbiage.  So replace
> "looks like ... a contract" by "is ... a contract".  (My reflective
> fetish means that I like that they're so similar, but in this case
> it's a bad property of the latter that is dragged to the former.)
> As for a suggestion, I don't have anything concrete (and I don't have
> nearly enough contract experience to say something concrete) -- but in
> general I prefer to see those important bits first, and the vague
> human text later.
>> On Fri, Dec 10, 2010 at 5:01 AM, Eli Barzilay <eli at barzilay.org> wrote:
>> > 5 minutes ago, Casey Klein wrote:
>> >>
>> >> For anyone following at home, the change turns this message [...]
>> >
>> > Ah, so that's what broke enough tests to make the build log explode...
>> >
>> >
>> >> into this one
>> >>
>> >> /Users/clklein/tmp/contract-violator.rkt:9.17: found a contradiction
>> >> between the contract (-> any/c any/c any/c) on #:equiv argument of
>> >> test--> for
>> >>   (file /Users/clklein/tmp/contract-violator.rkt)
>> >>  and its implementation; expected a procedure that accepts 2 mandatory
>> >> arguments without any keywords, given: 1; to fix adjust either the
>> >> contract or the implementation of
>> >>   (file /Users/clklein/tmp/contract-violator.rkt)
>> >
>> > (Not that my opinion should count for more than 5% of a vote, but this
>> > is IMO pretty horrible.  It makes it even more difficult to get to the
>> > important details, by wrapping them in text that looks like ... a
>> > contract.  Feels like the same annoying thing of digging through 10
>> > pages of a rent contract for the few places that list how you're being
>> > robbed.)
> --
>          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.