[racket-dev] chaperone-evt restrictions?

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Fri Aug 2 18:32:38 EDT 2013

Hi all,

I'm currently trying to implement contracts for synchronizable events.
During that, I've discovered that there seems to be an undocumented
restriction that `chaperone-evt` can only chaperone an event that is not
a handle event. Here's an example:

  -> (sync (chaperone-evt (handle-evt always-evt identity)
                          (lambda (e) (values e identity))))
  ; wrap-evt: contract violation
  ;   expected: (and/c evt? (not/c handle-evt?))
  ;   given: #<evt>
  ; [,bt for context]

This is problematic for Typed Racket. If the type system does not
distinguish handle events vs. not (as is the case now), there's no way
to refuse to generate a contract for the `handle-evt` case (which is
necessary if the contract can't work).

Also, is there supposed to be an `impersonate-evt` as well? I've noticed
that the C code has a few code paths that hint at such a primitive, but
it doesn't exist.


Posted on the dev mailing list.