<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is there actually a reason to use 'set!'? </blockquote><div><br>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.<br>
<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Also, it's suspicious that your 'queue-message' method takes an 'event' argument but then refers to the 'the-event' field.<br>
</blockquote><div><br>They are distinct. Sorry for the mislead, I should have used a better name in my edits for email.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
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:<br>
<br>
(define/private (queue-message receiver ....)<br>
....<br>
(let ([event-to-handle the-event])<br>
(set! the-event #f)<br>
(queue-callback<br>
(lambda () (send the-handler handle-event event-to-handle))<br>
#t))<br>
....)<span class="HOEnZb"><font color="#888888"><br>
<br></font></span></blockquote><div><br>Given the (perhaps incorrect?) requirement to use set!, this is exactly what I need, thanks.<br><br>Cheers,<br><br>Kieron.<br></div></div><br>