[racket] Problem passing a reference

From: Kieron Hardy (kieron.hardy at gmail.com)
Date: Mon Sep 17 14:32:55 EDT 2012

Hi all,

In the following fragment, I'm trying to create a new event, queue a
callback to some handler to process that event, and then clear the event.

    (define/private (create-message)
      ...
      (set! the-event (new some-event%))
      ...
      )

    (define/private (queue-message receiver event)
      ...
          (when can-queue-message?
            (queue-callback
              (lambda () (send the-handler handle-event the-event)))
              #t)
      ...
      (set! the-event #f)
      ...
      )

However the event value that the handler actually sees is #f, i.e. the
result after the event is cleared, and not as I want a reference to the
event to process, i.e. the object resulting from the call to new.

What is the best way to get to the handler, a reference to the event it
needs to process?

Cheers,

Kieron.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120917/6ea05646/attachment.html>

Posted on the users mailing list.