[racket] Trouble with nack-guard-evt

From: Tobias Hammer (tobias.hammer at dlr.de)
Date: Thu Mar 28 11:08:09 EDT 2013

Hi,

i am trying to understand how nack-guard-evt works. Therefore i created  
the appended test program. Sometimes it stops with the error message and  
sometimes it prints the three values. It is clear to me what the error  
means and why it is raised.
What i am not understanding is, why the nack generator is not run every  
time sync is called. I would have expected from the docs that it is run on  
every sync.
Can someone clarify why my assumptions are wrong and how nack-guard-evt is  
expected to behave?

Related question: The docs for the function talk abound 'proc', should it  
be 'generator'?

Tobias



;; -----------------------------

#lang racket

(define nack #f)

(sync (handle-evt
        always-evt
        (lambda (_) 'ALWAYS))
       (nack-guard-evt
        (lambda (e)
          (set! nack e)
          never-evt)))

nack
(printf "~a\n" (sync/timeout 0. nack))

> 'ALWAYS
#f
. . sync/timeout: contract violation
   expected: evt?
   given: #f
   argument position: 2nd
   other arguments...:
    0.0

OR

> 'ALWAYS
#<evt>
#<void>



-- 
---------------------------------------------------------
Tobias Hammer
DLR / Robotics and Mechatronics Center (RMC)
Muenchner Str. 20, D-82234 Wessling
Tel.: 08153/28-1487
Mail: tobias.hammer at dlr.de

Posted on the users mailing list.