Re: Using catch/throw inside a macro gives RuntimeException

2017-12-21 Thread crispin
Almost! That should be macroexpand, not macroexpand-1, in case the macro expands to another macro (I have 'catch-cause' for catching a nested expression and then 'catch-psql' that utilises that). (defmacro try [& body] (cons 'try (map macroexpand body))) Thanks again Crispin On Thursday, De

Re: Using catch/throw inside a macro gives RuntimeException

2017-12-21 Thread crispin
Ah that explains it, Alex. What I ended up doing is making a custom try macro that macroexpands its body forms and wraps them in a try, like this: (defmacro try* [& body] (cons 'try (map macroexpand-1 body))) So by the time try is handled, the inner custom catch macros are already expanded.

Re: Using catch/throw inside a macro gives RuntimeException

2017-12-20 Thread Alex Miller
`catch` is not a function or macro, it's special syntax only understood in the context of the special form `try`. You can't do this without writing your own form of try (see try+ in slingshot for an example of that). On Wednesday, December 20, 2017 at 9