diff --git a/collects/scribblings/reference/chaperones.scrbl b/collects/scribblings/reference/chaperones.scrbl index 8d719897c5..6fdeac3a8f 100644 --- a/collects/scribblings/reference/chaperones.scrbl +++ b/collects/scribblings/reference/chaperones.scrbl @@ -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} diff --git a/collects/scribblings/reference/contracts.scrbl b/collects/scribblings/reference/contracts.scrbl index c3695f328c..e94d634abd 100644 --- a/collects/scribblings/reference/contracts.scrbl +++ b/collects/scribblings/reference/contracts.scrbl @@ -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