[plt-dev] abstract contracts
I've added #:exists to provide/contract, as a way to hide information
ala "type t" declarations on ML signatures.
See the contracts section in the Guide for a worked example and a
discussion of a gotcha. The short version is that you can now write
things like this:
(provide/contract
#:exists stack
[new stack]
[push (-> int stack stack)]
[pop (-> (and/c stack non-empty?) int)]
[non-empty? (-> stack boolean?)])
and have the contract system enforce data abstraction, even if your
stack operations are simply these:
(define new '())
(define push cons)
(define pop car)
(define non-empty? pair?)
That is, clients of your module will not be able to treat your stacks
as if they were lists, even though they really are lists.
Robby