adjust spec of impersonator?
w.r.t. prop:impersonator-of
As implemented, `impersonator?` does not recognize values that impersponate others via `prop:impersonator-of`. Meanwhile, the use of `impersonator?` in the (unenforced) contract of `unsafe-struct*-ref` makes sense with that implementation, as does the offered rationale for sometimes using `impersonator?`. So, adjust the specification in the documentations, instead of adjusting the implementation.
This commit is contained in:
parent
cc487a4d9a
commit
e3e141d1fd
|
@ -65,12 +65,20 @@ types and their instances.
|
|||
|
||||
@defproc[(impersonator? [v any/c]) boolean?]{
|
||||
|
||||
Returns @racket[#t] if @racket[v] is an @tech{impersonator}, @racket[#f] otherwise.
|
||||
Returns @racket[#t] if @racket[v] is an @tech{impersonator} created by
|
||||
procedures like @racket[impersonate-procedure] or
|
||||
@racket[impersonate-struct], @racket[#f] otherwise.
|
||||
|
||||
Programs and libraries generally should avoid @racket[impersonator?] and
|
||||
treat impersonators the same as non-impersonator values. In rare cases,
|
||||
@racket[impersonator?] may be needed to guard against redirection by an
|
||||
impersonator of an operation to an arbitrary procedure.}
|
||||
impersonator of an operation to an arbitrary procedure.
|
||||
|
||||
A limitation of @racket[impersonator?] is that it does @emph{not}
|
||||
recognize an @tech{impersonator} that is created by instantiating a
|
||||
structure type with the @racket[prop:impersonator-of] property. The
|
||||
limitation reflects how those impersonators cannot redirect structure
|
||||
access and mutation operations to arbitrary procedures.}
|
||||
|
||||
|
||||
@defproc[(chaperone? [v any/c]) boolean?]{
|
||||
|
@ -78,7 +86,9 @@ impersonator of an operation to an arbitrary procedure.}
|
|||
Returns @racket[#t] if @racket[v] is a @tech{chaperone}, @racket[#f] otherwise.
|
||||
|
||||
Programs and libraries generally should avoid @racket[chaperone?] for
|
||||
the same reason that they should avoid @racket[impersonator?].}
|
||||
the same reason that they should avoid @racket[impersonator?]. A true
|
||||
value for @racket[chaperone?] implies a true value of
|
||||
@racket[impersonator?].}
|
||||
|
||||
|
||||
@defproc[(impersonator-of? [v1 any/c] [v2 any/c]) boolean?]{
|
||||
|
|
Loading…
Reference in New Issue
Block a user