From a8f748abeb72d105f77859bc394fda0580765d63 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sun, 8 Nov 2015 15:41:03 -0600 Subject: [PATCH] clarify some invariants of make-contract and friends --- .../scribblings/reference/contracts.scrbl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/racket-doc/scribblings/reference/contracts.scrbl b/pkgs/racket-doc/scribblings/reference/contracts.scrbl index 6b92ebb301..6ddd1022d9 100644 --- a/pkgs/racket-doc/scribblings/reference/contracts.scrbl +++ b/pkgs/racket-doc/scribblings/reference/contracts.scrbl @@ -1960,11 +1960,12 @@ contracts is @racketresult[anonymous-chaperone-contract], and for flat contracts is @racketresult[anonymous-flat-contract]. The first-order predicate @racket[test] can be used to determine which values -the contract applies to; usually, this is the set of values for which the +the contract applies to; this must be the set of values for which the contract fails immediately without any higher-order wrapping. This test is used -by @racket[contract-first-order-passes?], and indirectly by @racket[or/c] to -determine which of multiple higher-order contracts to wrap a value with. The -default test accepts any value. +by @racket[contract-first-order-passes?], and indirectly by @racket[or/c] + and @racket[from-or/c] to determine which higher-order contract to wrap a + value with when there are multiple higher-order contracts to choose from. + The default test accepts any value. The @racket[late-neg-proj] defines the behavior of applying the contract. If it is supplied, it accepts a blame object that does not have a value for @@ -1986,6 +1987,11 @@ first-order test fails, and produces the value unchanged otherwise. The @racket[val-first-proj] is like @racket[late-neg-proj], except with an extra layer of currying. +The projection arguments (@racket[late-neg-proj], @racket[proj], and + @racket[val-first-proj]) must be in sync with the @racket[test] argument. + In particular, if the test argument returns @racket[#f] for some value, + then the projections must raise a blame error for that value. + Projections for chaperone contracts must produce a value that passes @racket[chaperone-of?] when compared with the original, uncontracted value. Projections for flat contracts must fail precisely when the first-order test