[racket] try/catch/finally idiom in Racket

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Oct 8 19:40:59 EDT 2010

I use dynamic-wind for this. If there is something better, I don't
know what it is. dynamic-wind is a little bit funny though because if
you capture continuations then the in/out handlers can run multiple
times which might defy your expectations. You could set up a
continuation barrier on the inside to ensure that doesn't happen


On Fri, Oct 8, 2010 at 5:32 PM, Sam Phillips <samdphillips at gmail.com> wrote:
> Hi All,
> I understand using call-with-exception-handler/with-handlers/etc. to
> catch exceptions in a block of code, but I'm at a loss to what the best
> way to do a "finally" or cleanup action after a block of code.  My
> intuition is to use dynamic-wind, but I figure there may be a better way
> that I just cannot locate in the manual.
> Is there a way to do this that I just cannot find?
> Cheers,
> Sam
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.