Re: [julia-users] How to call macro stored in variable

2016-09-25 Thread Yichao Yu
On Sun, Sep 25, 2016 at 10:11 AM, Marius Millea wrote: > Ahh nice, thanks. Your macrocall suggestions reads cleanly too, I think it'd > look something like this: > > julia> macro macrocall(mac,args...) >Expr(:macrocall,esc(mac),map(esc,args)...) >end >

Re: [julia-users] How to call macro stored in variable

2016-09-25 Thread Marius Millea
Ahh nice, thanks. Your macrocall suggestions reads cleanly too, I think it'd look something like this: julia> macro macrocall(mac,args...) Expr(:macrocall,esc(mac),map(esc,args)...) end @macrocall (macro with 1 method) julia> @macrocall idmacro 1+2 3 What's the problem with

Re: [julia-users] How to call macro stored in variable

2016-09-25 Thread Yichao Yu
On Sun, Sep 25, 2016 at 7:25 AM, Marius Millea wrote: > I can store a macro to a variable (let use the identity macro "id" as an > example), > > julia> idmacro = macro id(ex) >:($(esc(ex))) >end > @id (macro with 1 method) > > > How can I use this macro

[julia-users] How to call macro stored in variable

2016-09-25 Thread Lutfullah Tomak
It you should return just esc(ex). It seems :($(esc(ex))) makes it an expression wrapping an expression.

[julia-users] How to call macro stored in variable

2016-09-25 Thread Marius Millea
I can store a macro to a variable (let use the identity macro "id" as an example), julia> idmacro = macro id(ex) :($(esc(ex))) end @id (macro with 1 method) How can I use this macro now? I can *almost* do it by hand by passing an expression as an argument and eval'ing the