On Sun, Sep 27, 2015 at 12:20 PM, Leonardo <[email protected]> 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)
> println(e2.head)
> end
>
> macro tst(e1::Expr)
> @tst2 esc(e1)
> end
```
macro tst(e1::Expr)
quote
@tst2 $(esc(e1))
end
end
```
otherwise, `@tst2` will be run at `tst` definition time.
> In previous code I want that call to @tst2 behave exact like call to @tst.
>
> E.g. calling @tst2 in REPL I obtain:
> julia> a = 2
> julia> @tst2(a < 3)
> comparison
> but same call to @tst has no effect, and I cannot find an alternative
> working form for @tst
>
> Someone can help me to understand this odd behaviour of Julia's macro?
>
> Many thanks in advance
>
> Leonardo
>