[racket-dev] impersonate-struct with only impersonator properties

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Jun 21 22:32:03 EDT 2012

At Tue, 19 Jun 2012 23:25:47 -0700, Eric Dobson wrote:
> The documentation for impersonate-struct and chaperone-struct differ
> in the fact that chaperone-struct explicitly says that only
> impersonator properties are not allowed. But the implementation
> doesn't allow it for either of them. Either the documentation or the
> implementation is wrong.

The docs are wrong. I'll fix that...

> What is the reasoning behind the implementation?

At some level, all Racket values are implemented as structs, but the
implementation of impersonator properties relies on a particular
representation of structs.

By supplying some operation to replace other than an
impersonator-property accessor, you provide a witness that the value is
represented in a way that `impersonate-struct' can handle (without
requiring that, say, `struct?' exposes the representation to everyone).

Posted on the dev mailing list.