> Is there actually a reason to use 'set!'?
There is a period of time between creating the message and actually processing the message. Other events may cause the message to be abandoned. Therefore I think the set! is required, but maybe there's a better solution. Also, it's suspicious that your 'queue-message' method takes an 'event' > argument but then refers to the 'the-event' field. > They are distinct. Sorry for the mislead, I should have used a better name in my edits for email. > If none of that works and you really have to use 'set!', then the solution > is to save the value to a local variable that doesn't get mutated and have > the callback refer to that instead of the field: > > (define/private (queue-message receiver ....) > .... > (let ([event-to-handle the-event]) > (set! the-event #f) > (queue-callback > (lambda () (send the-handler handle-event event-to-handle)) > #t)) > ....) > > Given the (perhaps incorrect?) requirement to use set!, this is exactly what I need, thanks. Cheers, Kieron.
____________________ Racket Users list: http://lists.racket-lang.org/users