racketcontracts

What impersonator contracts does Racket have in addition to `new-∀/c` and `new-∃/c`?


Racket contracts are classified in three categories: Flat Contracts, Chaperone Contracts and Impersonator Contracts.

For Impersonator contracts, the only example I could find are the contracts for parametric polymorphism. Are there any other examples in addition to these?


Solution

  • Object and class contracts (e.g., class/c, object/c, etc.) are currently all impersonator contracts. Though chaperone versions of those may be offered eventually. In contrast, it's not possible to make parameteric contracts into chaperone contracts.

    Recursive contracts constructed with recursive-contract also default to impersonator contracts, but can be configured to be any type.