removed _contract_ language from _invariant-..._ as much as possible

added a hint as to why the error message uses the inappropriate contract language
This commit is contained in:
Matthias Felleisen 2014-05-31 15:45:43 -04:00
parent 9d94ef725e
commit 89dea63995
3 changed files with 14 additions and 14 deletions

View File

@ -1509,24 +1509,24 @@ The @racket[define-struct/contract] form only allows a subset of the
(make-salmon #f 'pacific)
]}
@defform[(invariant-contract contract-expr expr)]{
Establishes an invariant of @racket[expr], determined by @racket[contract-expr].
@defform[(invariant-assertion invariant-expr expr)]{
Establishes an invariant of @racket[expr], determined by @racket[invariant-expr].
Unlike other ways to attach contracts to values, an
@racket[invariant-contract] does not establish a boundary
between two parties. Instead, it simply puts the contract
on the value, treating the module containing the
@racket[invariant-contract] expression as the party to be blamed
for any violations of the contract.
Unlike the specification of a contract, an
@racket[invariant-assertion] does not establish a boundary
between two parties. Instead, it simply attaches a logical assertion
to the value. Because the form uses contract machinery to check the
assertion, the surround module is treated as the party to be blamed
for any violations of the assertion.
This means, for example, that the contract is checked on
This means, for example, that the assertion is checked on
recursive calls, when an invariant is used on the right-hand
side of a definition.
side of a definition:
@examples[#:eval
furlongs->feet-eval
(define furlongss->feets
(invariant-contract
(invariant-assertion
(-> (listof real?) (listof real?))
(λ (l)
(cond

View File

@ -3,7 +3,7 @@
(provide contract
(rename-out [-recursive-contract recursive-contract])
current-contract-region
invariant-contract)
invariant-assertion)
(require (for-syntax racket/base syntax/name syntax/srcloc)
racket/stxparam
@ -89,7 +89,7 @@
(procedure-rename new-val vs-name)])]
[else new-val])))
(define-syntax (invariant-contract stx)
(define-syntax (invariant-assertion stx)
(syntax-case stx ()
[(_ ctc e)
(quasisyntax/loc stx

View File

@ -4,7 +4,7 @@
define/contract
with-contract
current-contract-region
invariant-contract)
invariant-assertion)
(require (for-syntax racket/base
racket/struct-info