I have read it several times. From my little experience, I think you mean:

- the `args` is defined inside the macro quote context, and used in the 
caller context where the quote expands to?
- and that's why var! comes to rescue?

在 2016年7月29日星期五 UTC+8上午2:23:41,Eric Meadows-Jönsson写道:
>
> 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 <[email protected] 
> <javascript:>> 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://www.google.com/url?q=https%3A%2F%2Fgist.github.com%2Flerencao%2F9a271ba31b6771f4563f645fae9b9815&sa=D&sntz=1&usg=AFQjCNE6d_LJEsmjXn0xoBrupBSkwIaXYg>
>> .
>> 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 [email protected] <javascript:>.
>> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-talk/2f17fe5e-6db7-4b3d-858c-41a6fd50aa0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to