> Correct me if I'm wrong, but isn't this not just specific to custom guards? 
> As far as I know, all macros behave this way because macro expansion happens 
> at compile time, and this sort of runtime-error within the generated code 
> can't know about the macro that produced it without some sort of new compiler 
> artifact to track the source?


I think so too, similarly for:

    defmodule Foo do
      def foo(x) when x in 1..5 do
        x
      end

      def foo(x) when x in [10, 20] do
        x
      end
    end

    Foo.foo(100)

We have:

     ** (FunctionClauseError) no function clause matching in Foo.foo/1

     The following arguments were given to Foo.foo/1:

         # 1
         100

     Attempted function clauses (showing 2 out of 2):

         def foo(x) when is_integer(x) and (x >= 1 and x <= 5)
         def foo(x) when x === 10 or x === 20

     code: Foo.foo(100)
     stacktrace:
       (foo 0.1.0) lib/foo.ex:2: Foo.foo/1
       test/foo_test.exs:5: (test)

It would be nice to see the original guards though!

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/3719707A-69AC-4451-97F0-EB4F6C24CD54%40wojtekmach.pl.

Reply via email to