There is no complecting involved since you can easily use catch alone, 
finally alone, or both. Exactly as you note, they are orthogonal. Of 
course, there is nothing wrong with your convenience macros, if they help 
your specific case. They are obviously special-case macros derived from the 
general Clojure try-catch-finally form.

-marko


On Tuesday, April 9, 2013 11:01:26 PM UTC+2, Emanuel Rylke wrote:
>
> I've been thinking about exceptions a bit and it occurred to me that the 
> catch and finally clauses are orthogonal.
> I mean code in a catch clause runs conditional on a exception being thrown 
> and code in a finally clause runs unconditional on whether there was an 
> exception or not.
>
> So i think using try only through something like the following macros 
> would make the intend of ones code more explicit.
>
> (defmacro simple-catch [maythrow & clauses]
>   `(try
>      ~maythrow
>      ~@(map #(cons 'catch %) clauses)))
>
> (defmacro simple-finally [maythrow & body]
>   `(try
>      ~maythrow
>      (finally
>       ~@body)))
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to