It's documented under "Hygiene for variables" here
http://elixir-lang.org/docs/stable/elixir/Kernel.SpecialForms.html#quote/2.

The reasoning for this behaviour is that variables from different contexts
shouldn't leak into each others contexts without making it explicit with
`var!`.

Your code doesn't work because `args` is used in a different context than
where it was defined.

On Wed, Jul 27, 2016 at 3:28 PM, Jiafeng Cao <funfriend...@gmail.com> wrote:

> Hi, I've been reading through about macros, and came across the `var!`. I
> thought I got the idea of it until I wrote some code like this gist
> <https://gist.github.com/lerencao/9a271ba31b6771f4563f645fae9b9815>.
> I know I can use `def unquote(name)(var!(args)), do: ...` to make it work.
> I just cannot get it.
> What's I missing here? Many thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-talk+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-talk/09af6955-28e3-4a14-8851-0bfa201dc760%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-talk/09af6955-28e3-4a14-8851-0bfa201dc760%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Eric Meadows-Jönsson

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-talk/CAM_eapj1NoarMycJtQ%2BfvXGpi_27xsx%3D43hvj_ZogrDaqOWA4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to