[plt-scheme] Contract changes a parameter-procedure to a procedure. Why?

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Fri Apr 16 14:54:45 EDT 2010

On Fri, Apr 16, 2010 at 2:51 PM, Greg Hendershott
<greghendershott at gmail.com> wrote:
> Thanks for the parameter/c tip Carl.
> Re baked in:
> So far contracts have worked pretty much as I expected on a practical
> level. This is the first time the implementation poked through and
> surprised me.  I probably do need to be careful about my C/C++ baggage
> which maybe primes me to not even expect there would be both
> parameter? and parameter/c, or why.

Don't use parameter/c as a drop-in replacement for parameter?, it
sounds like maybe that's what you're doing.  Instead, (parameter/c
boolean?) will construct a contract that (a) ensures values passed
through it are parameters, and (b) ensures that any values one
gets/sets through the guarded parameter are booleans.  It does this
guarding while still producing a value that is a parameter.


Posted on the users mailing list.