dynamic-wind is nice because it guarantees that the pre- and postconditions
for a chunk of code will be run regardless of continuation jumps,
exceptions, etc.  The only issue I have is that the three thunks do not
share scope, making it difficult to do setup/teardown workflows.  I feel
like I should be able to make this work with nested dynamic-wind or
with-handlers but haven't been able to get there without losing the
guarantee of running.  Is there a way?

Example of what I'd like to do:

(my-dynamic-wind
  (thunk (define conn (connect-to-server)))
  (thunk (send-message conn "foo"))
  (thunk (finalize-connection conn)))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAE8gKodTcogsfeiYKu5iyFbL4H%2Ba3dzuL7rLTfYERD%2BauFD9xQ%40mail.gmail.com.

Reply via email to