[plt-scheme] Asynchronous Let
This `let/async' you want is not hard: using syntax-rules only is enough.
(define-syntax let/async
(syntax-rules ()
((_ ((name thunk) ...)
body ...)
(thread
(lambda ()
(letrec ((name name) ...)
(for-each thread-wait
(list
(thread
(lambda ()
(set! name
(with-handlers (((lambda (x) #t) values))
(thunk))))) ...))
body ...))))))
> I'd like to use this idiom for writing asynchronous operations,
particularly with socket connections, in an easy to read style. Or is
there a better way to do this?
The way exception is bound to "name"s doesn't seems natural to me.
Chongkai