[racket-dev] TR & check-equal?

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Wed May 29 07:53:54 EDT 2013

That is indeed the correct fix.  I'm not entirely sure how to improve
the error message, since the problem in your original code is real.
There's no way the generated contract can tell at runtime that the
values passed to `check-equal?` aren't higher-order, so it has to
conservatively reject the call.  Suggestions are certainly welcome.

Sam

On Wed, May 29, 2013 at 7:46 AM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> I'm not sure if this should be considered a bug or a feature request (or
> something else, but hopefully one of those two!) so I thought I'd ask here
> before sending in a PR. This program:
>
>   #lang typed/racket
>   (require typed/rackunit)
>   (struct: s ([a : Integer]))
>   (check-equal? (s 1) (s 2))
>
> produces the output:
>
> check-equal?: broke its contract
>   Attempted to use a higher-order value passed as `Any` in untyped code:
> #<s>
>   in: the 1st argument of
>       (recursive-contract
>        (->* (Any Any) (String) any/c)
>        #:impersonator)
>   contract from: (interface for check-equal?)
>   blaming: (interface for check-equal?)
>   at: <collects>/typed/rackunit/main.rkt:20.2
>
> which is a bit confusing. (As someone who's been around Racket long enough,
> I guessed that sticking #:transparent into the struct declaration would be a
> thing to try, but newcomers seem unlikely to find that workaround.)
>
> Robby
>
>
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
>

Posted on the dev mailing list.