Delete racket/exists paragraph (#2873)
* Delete racket/exists paragraph * Remove @ctc-link for exists-gotcha
This commit is contained in:
parent
2edea7db0d
commit
eb20dc4463
|
@ -56,4 +56,3 @@ To ensure that the queue representation is abstract, we can use @racket[#:∃] i
|
|||
Now, if clients of the data structure try to use @racket[car] and @racket[cdr], they
|
||||
receive an error, rather than mucking about with the internals of the queues.
|
||||
|
||||
See also @ctc-link["exists-gotcha"].
|
||||
|
|
|
@ -108,27 +108,6 @@ Moral: if two values with contracts should interact,
|
|||
put them in separate modules with contracts at
|
||||
the module boundary or use @racket[#:freevar].
|
||||
|
||||
@ctc-section[#:tag "exists-gotcha"]{Exists Contracts and Predicates}
|
||||
|
||||
Much like the @racket[eq?] example above, @racket[#:∃] contracts
|
||||
can change the behavior of a program.
|
||||
|
||||
Specifically,
|
||||
the @racket[null?] predicate (and many other predicates) return @racket[#f]
|
||||
for @racket[#:∃] contracts, and changing one of those contracts to @racket[any/c]
|
||||
means that @racket[null?] might now return @racket[#t] instead, resulting in
|
||||
arbitrarily different behavior depending on how this boolean might flow around
|
||||
in the program.
|
||||
|
||||
@defmodulelang[racket/exists]
|
||||
|
||||
To work around the above problem, the
|
||||
@racketmodname[racket/exists] library behaves just like @racketmodname[racket],
|
||||
but predicates signal errors when given @racket[#:∃] contracts.
|
||||
|
||||
Moral: Do not use predicates on @racket[#:∃] contracts, but if you're not sure, use
|
||||
@racketmodname[racket/exists] to be safe.
|
||||
|
||||
@ctc-section{Defining Recursive Contracts}
|
||||
|
||||
When defining a self-referential contract, it is natural to use
|
||||
|
|
Loading…
Reference in New Issue
Block a user