[racket-dev] Class contracts: opaque or transparent?

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Fri Apr 27 17:55:08 EDT 2012

On 2012-04-27 17:44:06 -0400, Matthias Felleisen wrote:
> [[If you mentioned this issue in my office yesterday, I failed to catch it.]]

I remembered/thought it as I was composing the e-mail.

> In the old world, I could write contracts such as
>  (and/c (class/cc ...) (class/c ...))
> and that was *really convenient*. Are you saying I can
> no longer do so?

You can write that, but the following isn't very useful:
  (and/c (class/c #:opaque [m (->m number? number?)])
         (class/c #:opaque [n (->m number? number?)]))

Since the two class contracts both reject classes that the other would
accept (unless `and/c` somehow merged the first-order checks of the
two rather than checking both separately).

It works if the two contracts mention exactly the same members.


Posted on the dev mailing list.