I find it quite helpful to use dump() on expressions to see the first few 
levels of the parsed AST. That makes it easier to see what Julia is doing 
with your expressions.

On Thursday, May 22, 2014 5:17:13 PM UTC-4, Andrew McKinlay wrote:
>
> I have been trying to grok Julia macros, so I've dived into the 
> metaprogramming docs. Whilst playing around with the interpreter, I've run 
> into some peculiarities that I don't quite understand.
>
> julia> versioninfo()
> Julia Version 0.3.0-prerelease+2690
> Commit e4c2f68* (2014-04-20 12:15 UTC)
> ...
>
>
>    1. Why is typeof( :(:(1+2)) ) == Expr, but typeof( :(:(1)) ) == 
>    QuoteNode?
>    2. Why is typeof( :(1) ) == Int64, but again typeof( :(:(1)) ) == 
>    QuoteNode?
>    3. Why is typeof( :(1+:($1+2)).args[3].args[1] ) == TopNode?
>
>
> I was assuming that quoting was just a shorthand way for constructing 
> expressions, since the docs say:
>
>> There is special syntax for “quoting” code (analogous to quoting strings) 
>> that makes it easy to create expression objects without explicitly 
>> constructing Expr objects. 
>
> But the types of objects constructed by quoting do not always take the 
> form of an Expr, as above.
>
> What is going on here?
>

Reply via email to