Just to provide slightly more info, that change was made because of this
ticket: http://dev.clojure.org/jira/browse/CLJ-1169

Andy

On Wed, Jun 3, 2015 at 6:34 AM, Mike Rodriguez <mjr4...@gmail.com> wrote:

> Sorry for the delay in getting back with a response to this.  I think it
> is fairly clear in the Clojure Compiler that there is an exception that
> will wrap errors that occur during macroexpansion now.
>
> Around here
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6627-L6649,
> the Compiler.macroexpand1() now has a try-catch for Throwable around the
> evaluation of the macro invocation.
> This was not the case in Clojure version 1.6.  See around
> https://github.com/clojure/clojure/blob/clojure-1.6.0/src/jvm/clojure/lang/Compiler.java#L6548-L6560
> for a reference point.
>
> I'm fairly sure that is what has caused this change in behavior that broke
> our expectations that the exception types our code through during
> macroexpansion would propagate all the way back to the caller.  Again, I
> think this was a bad expectation to have, but it is a little tricky.
>
> It is a little trickier for us to have any strong assertions on the type
> of exception that may come from a macro now.  Compiler$CompilerException
> seems too dependent on the implementation.  So we've opted to just assert
> there would be a is-thrown? RuntimeException in these sorts of tests.  If
> we want to test something like an ExceptionInfo's data map, we now just
> have to write a helper to walk the stack trace until we find it - which
> would likely be a single "step" up the trace.
>
> A simple reproducing case:
> *clojure-version* ;= {:major 1, :minor 7, :incremental 0, :qualifier "RC1"}
>
> (defmacro demo [] (throw (ex-info "fail" {})))
>
> (demo) ;= CompilerException clojure.lang.ExceptionInfo: fail {},
> compiling:(form-init4053282905768384039.clj:1:1)
>
> vs.
> *clojure-version* ;= {:major 1, :minor 6, :incremental 0, :qualifier nil}
>
> (demo) ;= ExceptionInfo fail  clojure.core/ex-info (core.clj:4403)
>
>
>
> On Saturday, May 23, 2015 at 8:52:47 AM UTC-5, Alex Miller wrote:
>>
>> I'm not aware of any wholesale changes with respect to compiler
>> exceptions. Can you give an example?
>
>  --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to