[plt-scheme] handle-evt can wrap handle-evt

From: Dimitris Vyzovitis (vyzo at media.mit.edu)
Date: Wed Feb 21 22:06:07 EST 2007

On Wed, 21 Feb 2007, Robby Findler wrote:

> No no - you misunderstand. Of course, that is the main technique for
> all CML-style programs! Everyone knows that.
> When there is a single handle-evts, its proc should be called in tail
> position wrt to the sync. But no one is proposing making all of them
> in  tail-position wrt to the sync. That's not possible. (Matthew
> proposed an error.)

Uhm, I am not sure what you mean here.
If there are non-handle-evts in the arguments to sync, then their
procs are of course not in tail context, but with handle-evt terminal,
then their procs are all in tail context even when there is many of them.

(let lp ((blah #f))
  (sync (handle-evt always-evt lp) (handle-evt always-evt lp)))

should still be omega and

(let ((end (alarm-evt (+ (current-time) 1000))))
  (let lp ((blah #f))
    (sync (handle-evt always-evt lp)
          (wrap-evt end void))))

should eventually evaluate to void without consuming any memory in the

The point is to disallow (handle-evt (handle-evt ...) ...)
That's what Matthew meant (I think :) and I don't see any error to it.

-- vyzo

Posted on the users mailing list.