[racket-dev] contracts not okay?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Jul 12 20:19:34 EDT 2012

On Thu, Jul 12, 2012 at 7:57 PM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:
> On 2012-07-12 19:38:44 -0400, Matthias Felleisen wrote:
>> > | I updated and noticed that this was now failing because interface
>> > | contracts are not check structurally (any more?).
> I don't think this is a case of checking structurally or not. It is
> not valid, for example, for the following behavioral subtyping to
> hold:
>   (-> number? boolean?)
>     <:
>   (-> number? [number?] boolean?)
> since the former cannot be used in contexts that expect to apply the
> optional argument (using imaginary contract notation where [...] means
> optional).
> You might want this to be okay in the other direction (though interface
> contracts will currently not allow it).

You are misunderstanding. There were two issues.

First, the interface wasn't even being associated with the class. This
was the source of my structural/not comment.

Second, the interface contract (based on the documentation) was wrong
because the documentation is wrong. None of the implementation
actually take the optional arguments.

I "fixed" both of these things. The first was definitely a fix. The
second might just be a sign of a regression against the old MrEd.


>> > | Should I change the documentation or is
>> > | this a bad backwards incompatibility with the older versions?
> I don't have an opinion on this since I'm not too familiar with
> gl-context<%>s. I wrote the contract based on the documentation.
> Cheers,
> Asumu
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the dev mailing list.