[racket] try/catch/finally idiom in Racket
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
though.
Jay
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
http://teammccarthy.org/jay
"The glory of God is Intelligence" - D&C 93