Thank you for the link. However, I am familiar with interpolation. What I 
don't understand is how you change `test2` in order to use it. Because 
there's no quote directly in that macro, Julia will complain about using 
'$' in a non-quoted expression.

On Wednesday, March 18, 2015 at 8:37:25 AM UTC-4, Isaiah wrote:
>
> See 
> http://docs.julialang.org/en/release-0.3/manual/metaprogramming/#interpolation
> On Mar 18, 2015 8:08 AM, "Abe Schneider" <abe.sc...@gmail.com 
> <javascript:>> wrote:
>
>> If I do something simple like:
>>
>> macro test()
>>  :(parsefloat("3.1459"))
>> end
>>
>> @test() 
>>
>> # 3.1459
>>
>> everything works as expected. However, if I try this instead:
>>
>> macro test2(ex)
>>  ex
>> end
>>
>> @test2(:(parsefloat("3.1459")))
>>
>> # :(parsefloat("3.1459"))
>>
>>
>> Not what I expected, but it makes sense what's happening:
>>
>> macroexpand(:(@test(:(parsefloat("3.1459")))))
>>
>> # :($(Expr(:copyast, :(:(parsefloat("3.1459"))))))
>>
>> So, anything I pass to the macro is automatically quoted. Obviously if I 
>> just do:
>>
>> @test2(parsefloat("3.1459"))
>>
>> it will work. However, the use-case I'm trying to deal with is that I 
>> have an Expr that I would like inserted into the AST. Besides being frowned 
>> on, I can't eval, due to not wanting things to be evaluated in global space.
>>
>> Is there some way I can unquote the expression in the macro for test2?
>>
>

Reply via email to