[racket] Confusing blame message

From: Daniel Prager (daniel.a.prager at gmail.com)
Date: Mon Sep 2 08:22:34 EDT 2013

Consider this file:

#lang racket
(define/contract (twice x)
  (-> number? number?)
  (* 2 x))

(twice 'foo)

When run in DrRacket 5.3.6 this yields the following error:

twice: contract violation
 expected: number?
 given: 'foo
 in: the 1st argument of
      (-> number? number?)
 contract from: (function twice)
 blaming: .../blame-test.rkt
 at: .../blame-test.rkt: 2.18

The final line attributes blame to the twice function (line 2, col 18), but
clearly the blame in this instance lies with the client code (line 6),
consistent with the first six lines of the error message.

Is this the intended behaviour?

Many thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130902/aa199238/attachment.html>

Posted on the users mailing list.