[plt-scheme] provide/contract

From: Will Farr (farr at mit.edu)
Date: Mon Oct 27 23:37:35 EDT 2008


Do you include the (require ...) line for image.ss *before* you have
the (provide/contract ...) form?  I've found contracts to be sensitive
to the order in which things are defined---any function definitions
used in the contracts (in this case image?, in my normal use case a
structure predicate) must be defined before the (provide/contract ...)
form is encountered.  I don't really know why this is the case, but I
assume it's hard to fix, or the PLT people would have fixed it


On Mon, Oct 27, 2008 at 11:30 PM, Stephen Bloch <sbloch at adelphi.edu> wrote:
> Trying to learn about these enforced-contract things by adding
> "provide/contract" to some of my teachpacks.  For example,
> (provide/contract (show-pinhole (-> image? image?))
>                               (crop-top (-> image? number? image?))
>                               (image-beside? (->* (image? image?) () #:rest
> (listof image?) image?)
>                               ...)
> Unfortunately, this doesn't pass a syntax check: as soon as there is even
> one (simple, like show-pinhole) provide/contract involving images, it says
> "unbound variable in module in: image?"  This is especially puzzling as I've
> been using image-library functions throughout the rest of the source file
> with no difficulty; it seems only provide/contract that can't find them.
>  I've already got
> ..
> (require (lib "image.ss" "htdp"))
> ..
> (provide (all-from (lib "image.ss" "htdp")))
> ..
> What more do I have to do for provide/contract to know what an "image?" is?
> Stephen Bloch
> sbloch at adelphi.edu
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.