[plt-dev] abstract contracts

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Sep 8 08:18:07 EDT 2009


On Sep 8, 2009, at 4:36 AM, Carl Eastlund wrote:

> On Mon, Sep 7, 2009 at 7:01 PM, Jacob  
> Matthews<jacobm at cs.uchicago.edu> wrote:
>> On Sun, Sep 6, 2009 at 3:14 PM, Robby
>> Findler<robby at eecs.northwestern.edu> wrote:
>>> Right. That wouldn't be parametric.
>>
>> I think it's the contracts-don't-change-programs condition, not the
>> parametricity condition, that would be violated here.
>>
>> -jacob
>
> Don't these contracts already change the program?  I thought, since
> Robby indicated that "stacks" cannot be used as lists, these contracts
> would be wrapping the values in opaque structs for outside observers.
> Adding or removing the contracts changes how a list-implemented stack
> responds to list?.  Or have I misunderstood the behavior of #:exists
> contracts?

They do in the sense that

  (if (pair? stack)
      (launch-nuclear-missile #:target 'HydePark at Chicago)
      (printf "hello world"))

produces two different results if you remove #:exists naively.

I assume that Robby has a mechanism that says #:wrap-automatically
and is the 'replacement' of contracts in plain provide in order to
avoid the destruction of his neighborhood.

Thanks for reminding me of this. Sam and I had an example like this
that explained why we couldn't use plain polymorphic contracts to
control exports from Typed Scheme.

-- Matthias



Posted on the dev mailing list.