does quote...end really create a QuoteNode?

69 views
Skip to first unread message

Spencer Russell

unread,
Aug 28, 2016, 12:27:12 AM8/28/16
to julia...@googlegroups.com
the metaprogramming docs say that `quote…end` produces a `QuoteNode`, but when I try:

julia> quo = quote
       x=2
       y=3
       end
quote  # none, line 2:
    x = 2 # none, line 3:
    y = 3
end

julia> noquo = :(
       x=2;
       y=3)
quote
    x = 2
    y = 3
end

and `dump` the results, they both seem the same except for the presence of line number nodes in the `quote…end` one (on 0.4.6 and 0.5). Is there something else that creates the `QuoteNode`?

Thanks,
Spencer

Tim Holy

unread,
Aug 28, 2016, 4:33:22 AM8/28/16
to julia...@googlegroups.com
julia> qn = :(:n)
:(:n)

julia> ex = :("My docstring about n, which has value $($qn))")
:("My docstring about n, which has value $(:n))")

julia> dump(ex)
Expr
head: Symbol string
args: Array{Any}((3,))
1: String "My docstring about n, which has value "
2: QuoteNode
value: Symbol n
3: String ")"
typ: Any

julia> dump(qn)
QuoteNode
value: Symbol n

--Tim
Reply all
Reply to author
Forward
0 new messages