Well, '311' did create a common culture. Good.
On Jul 6, 2012, at 3:15 AM, Rüdiger Asche wrote: > by the way, you were absolutely right, of course. I must have been blind on > both ears and deaf on both eyes not to think about CPS in this case. It works > like a charm now! > > Thanks again! > >> >> ----- Original Message ----- From: "Matthias Felleisen" >> <matth...@ccs.neu.edu> >> To: "Rüdiger Asche" <r...@ruediger-asche.de> >> Cc: "users" <users@racket-lang.org> >> Sent: Thursday, July 05, 2012 8:06 PM >> Subject: Re: [racket] again: timeouts and exceptions >> >> >> >> 1. I don't know where this prose is but it reads rather confusing. >> >> 2. If I were you, I'd use an escape continuation rather than an >> exception handler here. What you seem to want is flow of control, and >> let/ec is the right tool then. >> >> >> >> >> >> On Jul 5, 2012, at 9:42 AM, Rüdiger Asche wrote: >> >>> Hi there, >>> >>> a few of you recommended to implement timeouting reads via sync/timeout. >>> That works neat, but it would be even nicer to combine this w/ exception >>> handling, like so: >>> >>> >>> ... >>> ((readbytetimeout) >>> (lambda (port) >>> (if (sync/timeout READTIMEOUT inport) >>> (read-byte inport) >>> (raise "read-byte" #t)))) >>> ... >>> ((readsomething) ..... (readbytetimeout) ...... >>> >>> >>> (letrec ((repl (lambda () >>> (dosomethingthatmustexecuteperiodically) >>> (let ((readresult >>> (call-with-exception-handler HandlerFn >>> (readsomething)))) >>> (repl))))) >>> (repl)) >>> >>> Iow, I want the REPL to always be operational but restart from the >>> beginning when the innermost read timeouts so that the periodic >>> computations get their turn. >>> >>> I didn't get this to work though because according to the docs, "If the >>> exception handler returns a value when invoked by raise, then raise >>> propagates the value to the «previous» exception handler (still in the >>> dynamic extent of the call to raise, and under the same barrier, if any)." >>> >>> That is true; I get thrown back out of the entire thing because the >>> default uncaught exception handler is called. What ectually does it mean >>> "IF the >>> exception handler..." How is it possible for a function NOT to return a >>> value? >>> Any return value including #f and () will propagate the exception to the >>> default handler; I simply want to stop it where it is. >>> >>> What do I need to do (or paraphrased: What is the necessary implementation >>> of HandlerFn) in order to get this to work? Or do I need yet another >>> control flow or handling mechanism? >>> >>> Thanks! >>> >>> >>> >>> ____________________ >>> Racket Users list: >>> http://lists.racket-lang.org/users >> >> ____________________ >> Racket Users list: >> http://lists.racket-lang.org/users > > > ____________________ Racket Users list: http://lists.racket-lang.org/users