[plt-scheme] Contract Error Message

From: David Van Horn (dvanhorn at ccs.neu.edu)
Date: Mon Jul 20 14:59:59 EDT 2009

Carl Eastlund wrote:
> On Mon, Jul 20, 2009 at 2:40 PM, David Van Horn<dvanhorn at ccs.neu.edu> wrote:
>> Carl Eastlund wrote:
>>> What you wrote was a perfectly acceptable contract that functioned
>>> perfectly, except that it wasn't the one you meant it to be.  What
>>> alternate behavior would you propose?
>> Actually, Paulo broke the contract on or/c, so this could have a better
>> error message without changes to the contract language.
>>
>> David
> 
> Not according to the documentation I find here:
> 
> http://docs.plt-scheme.org/reference/contracts.html
> 
> Constants are perfectly acceptable contracts.  If the contract?
> function doesn't accept them, then either contract? needs to start
> accepting them or or/c needs to be documented with a more general
> contract.  But values like #f, 'foo, or 5 are usable with most
> contract primitives.

Ah, yes, (contract? #f) => #t, which I forgot.

However, or/c accepts any number of predicates and *higher-order* 
contracts, so perhaps the or/c contract can be refined to enforce this 
aspect of the specification?

David


Posted on the users mailing list.