An impersonator cannot be applied to an immutable value or refine the access to an immutable field in an instance of a structure type, since arbitrary redirection of an operation amounts to mutation of the impersonated value.
On the other hand:
> (struct person (name age) #:transparent) > (define bob (person 'bob 17)) > (define get (impersonate-procedure person-name (λ (v) (values (λ (v) 'tom) v)))) > (get bob) 'tom
After a bit of digging around I realized that, as shown above, it's fine to create a random function that impersonates a struct accessor and save it off somewhere, and that (AFAIK) the restriction only applies to impersonators that are attached to the struct directly by way of
> (impersonate-struct person person-name (λ (self current-val) (displayln "redirected!") current-val)) ; impersonate-struct: cannot replace operation for an immutable field ; operation kind: property accessor ; operation procedure: #<procedure:person-name>
Do I have this right?