Thank you Jameson!* esc()* does the trick :)

El sábado, 12 de septiembre de 2015, 21:56:19 (UTC-3), Jameson escribió:
>
> You also need to call `esc()` on any symbol you want to "leak" into the 
> outer scope. Otherwise, it will be turned into a unique symbol name visible 
> only to the code generated by that macro.
>
>
> On Sat, Sep 12, 2015 at 5:45 PM Diego Javier Zea <dieg...@gmail.com 
> <javascript:>> wrote:
>
>> I don't understand why am I getting this error? My macros can not find 
>> the variables inside *let* blocks. How Can I fix it? Thanks in advance
>>
>> julia> macro example(var)
>>        dump(var)
>>        @eval dump($var)
>>        end
>>
>> julia> msg = "hola"
>> "hola"
>>
>> julia> @example msg
>> Symbol msg
>> ASCIIString "hola"
>>
>> julia> let m = "hola"
>>        @example m
>>        end
>> Symbol m
>> ERROR: UndefVarError: m not defined
>>  in eval_user_input at REPL.jl:64
>>  [inlined code] from REPL.jl:93
>>  in anonymous at task.jl:68
>>
>>
>>
>>
>>

Reply via email to