[plt-scheme] contracts & coercing

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Sep 13 18:46:54 EDT 2008

I've cleaned up and extended the code that coerced non-contracts to
contracts. It used to be that only predicates were turned into
contracts automatically, but now symbols, booleans, regular
expressions and a bunch of other things can all be used directly as
contracts (all of them just use an appropriate equality predicate to
compare the contract value to the value that shows up, except regexps
which accept strings & bytess and match their inputs -- see
coerce-contract in the docs for details).

If there are other values that are natural contracts that I've missed,
please let me know. Also, if you're writing contract combinators, use
coerce-contract (or one of its new friends) on your combinator's
arguments.

(Also the nightly builds don't yet have this, but will tomorrow, I expect.)

Robby


Posted on the users mailing list.