Documentation for control proxies & prompt/c

This commit is contained in:
Asumu Takikawa 2012-06-11 15:46:36 -04:00
parent 5aa76c27a9
commit 87ecb55d40
2 changed files with 51 additions and 0 deletions

View File

@ -323,6 +323,30 @@ to @racket[impersonate-hash] must be odd) add impersonator properties
or override impersonator-property values of @racket[hash].}
@defproc[(impersonate-prompt-tag [prompt-tag continuation-prompt-tag?]
[handle-proc procedure?]
[abort-proc procedure?]
[prop impersonator-property?]
[prop-val any] ... ...)
(and/c continuation-prompt-tag? impersonator?)]{
Returns an impersonator of @racket[prompt-tag], which adds intercession
to the handler of @racket[call-with-continuation-prompt] and to
@racket[abort-current-continuation].
The @racket[handle-proc] must accept the values that the handler
of a continuation prompt would take and it must produce replacement
values, which will be passed to the handler.
The @racket[abort-proc] must accept the values passed to
@racket[abort-current-continuation]; it must produce replacement
values, which are aborted to the appropriate prompt.
Pairs of @racket[prop] and @racket[prop-val] (the number of arguments
to @racket[impersonate-prompt-tag] must be odd) add impersonator properties
or override impersonator-property values of @racket[prompt-tag].}
@defthing[prop:impersonator-of struct-type-property?]{
A @tech{structure type property} (see @secref["structprops"]) that
@ -519,6 +543,18 @@ Pairs of @racket[prop] and @racket[prop-val] (the number of arguments
to @racket[chaperone-evt] must be even) add impersonator properties
or override impersonator-property values of @racket[evt].}
@defproc[(chaperone-prompt-tag [prompt-tag continuation-prompt-tag?]
[handle-proc procedure?]
[abort-proc procedure?]
[prop impersonator-property?]
[prop-val any] ... ...)
(and/c continuation-prompt-tag? chaperone?)]{
Like @racket[impersonate-prompt-tag], but produces a chaperoned value.
The @racket[handle-proc] procedure must produce the same values or
chaperones of the original values, and @racket[abort-proc] must produce
the same values or chaperones of the values that it is given.}
@; ------------------------------------------------------------
@section{Impersonator Properties}

View File

@ -490,6 +490,21 @@ to the input. The result will be a copy for immutable hash tables, and either a
}
@defproc[(prompt/c [contract contract?] ...) contract?]{
Takes any number of contracts and returns a contract that recognizes
continuation prompt tags and will check any aborts or prompt handlers that
use the contracted prompt tag.
Each @racket[contract] will check the corresponding value passed to
an @racket[abort-current-continuation] and handled by the handler of a
call to @racket[call-with-continuation-prompt].
If all of the @racket[contract]s are chaperone contracts, the resulting
contract will also be a @tech{chaperone} contract. Otherwise, the contract is
an @tech{impersonator} contract.
}
@defform[(flat-rec-contract id flat-contract-expr ...)]{
Constructs a recursive @tech{flat contract}. A