New impersonator-of? docs

This commit is contained in:
Daniel Feltey 2017-04-12 14:35:38 -05:00 committed by Vincent St-Amour
parent de0d84f7b3
commit e29dba115b

View File

@ -86,59 +86,19 @@ the same reason that they should avoid @racket[impersonator?].}
Indicates whether @racket[v1] can be considered equivalent modulo Indicates whether @racket[v1] can be considered equivalent modulo
impersonators to @racket[v2]. impersonators to @racket[v2].
Any two values that are @racket[eq?] to one another are also @racket[impersonator-of?].
For values that include no impersonators, @racket[v1] and @racket[v2] can For values that include no impersonators, @racket[v1] and @racket[v2] can
be considered impersonators of each other if they are @racket[equal?]. be considered impersonators of each other if they are @racket[equal?].
Otherwise, impersonators within @racket[v2] must be intact within Otherwise at least one of @racket[v1] or @racket[v2] is an impersonator.
@racket[v1]:
@itemlist[ @itemlist[
@item{If @racket[v1] impersonates @racket[_v1*] then @racket[(impersonator-of? v1 v2)]
@item{If a part of @racket[v2] is an impersonator created from one of is @racket[#t] if and only if @racket[(impersonator-of? _v1* v2)] is @racket[#t].}
the impersonator constructors (e.g., @item{If @racket[v2] is a non-interposing impersonator that impersonates @racket[_v2*], i.e.,
@racket[impersonate-procedure] or all of its interposition procedures are @racket[#f], then @racket[(impersonator-of? v1 v2)]
@racket[chaperone-procedure]), and if the impersonator is is @racket[#t] if and only if @racket[(impersonator-of? v1 _v2*)] is @racket[#t].}
constructed with at least one redirection procedure (i.e., a @item{When @racket[v2] is an impersonator constructed with at least one non-@racket[#f] interposition procedure,
value other than @racket[#f] was supplied for a redirection but @racket[v1] is not an impersonator then @racket[(impersonator-of? v1 v2)] is @racket[#f].}]}
procedure), then the corresponding part of @racket[v1] must be
one of the following:
@itemlist[
@item{the same value that is a part of @racket[v2] (with a
special meaning of ``the same value`` in the case of
immutable hash tables, as described below);}
@item{a value further derived from the same value that is
part of @racket[v2] using an impersonator constructor;
or}
@item{a value with the @racket[prop:impersonator-of] property
whose procedure produces an impersonator of the same value
that is part of @racket[v2].}
]
For most kinds of values, ``the same value'' means equal
according to @racket[eq?]. In the case of an immutable hash
table, two impersonated hash tables count as ``the same value''
when their redirection procedures were originally attached to a
hash table by the same call to @racket[impersonate-hash] or
@racket[chaperone-hash] (and potentially propagated by
@racket[hash-set], @racket[hash-remove], or
@racket[hash-clear]), as long as the content of the first hash
table is @racket[impersonator-of?] of the second hash table.}
@item{If a part of @racket[v2] is a structure or procedure impersonator that was
created with no redirection procedures (i.e, @racket[#f] in
place of all redirection procedures for specified operations),
then the impersonated value is considered in place of that part
of @racket[v2]. In other words, an impersonator construction
that does not redirect any access or mutation (but that
includes some @tech{impersonator properties}) need not be
preserved in @racket[v1].}
]}
@defproc[(chaperone-of? [v1 any/c] [v2 any/c]) boolean?]{ @defproc[(chaperone-of? [v1 any/c] [v2 any/c]) boolean?]{