Many thanks, your message has clarified me many doubts!
But - sorry for my difficulty about these items - I cannot found a way
to obtain desired result in a more articulated scenario.
I would pass an expression into a macro to another one, manipulating it
as expression in nested macro. Eg:
On Mon, Oct 5, 2015 at 2:54 PM, Leonardo wrote:
> Many thanks, your message has clarified me many doubts!
> But - sorry for my difficulty about these items - I cannot found a way to
> obtain desired result in a more articulated scenario.
print, macroexpand, Meta.show_sexpr
What is correct form in this case?
The exact same problem again: you need to *quote* the returned expression
from the macro, to make sure that the code is run when the macro is called,
and not when it’s defined.
This will work as intended:
macro tst(i::Int)
quote
tst3(i)
end
On Mon, Sep 28, 2015 at 2:45 AM, Tomas Lycken wrote:
> What is correct form in this case?
>
> The exact same problem again: you need to quote the returned expression from
> the macro, to make sure that the code is run when the macro is called, and
> not when it’s defined.
On Sun, Sep 27, 2015 at 12:20 PM, Leonardo wrote:
> Hi all,
> I need manipulate AST of an expression in a macro, and pass same expression
> in input to another macro, but I experience some problem.
>
> I try to express my doubt with a simplified example:
> macro tst2(e2::Expr)
Hi all,
I need manipulate AST of an expression in a macro, and pass same expression
in input to another macro, but I experience some problem.
I try to express my doubt with a simplified example:
macro tst2(e2::Expr)
println(e2.head)
end
macro tst(e1::Expr)
@tst2 esc(e1)
end
In previous
Many thanks!
I have a similar problem calling a function in following scenario:
function tst3(i::Int)
println(i)
end
macro tst(i::Int)
tst3(i)
end
I obtain an error executing code:
julia> b = 2::Int
julia> @tst b
complaining for a problem of type, because tst3 seems to receive a