Why does Julia add extra :($? For instance:
julia> :(:(:(1+2)))
:($(Expr(:quote, :($(Expr(:quote, :(1 + 2)))))))
Why does Julia add extra :($? For instance:
julia> :(:(:(1+2)))
:($(Expr(:quote, :($(Expr(:quote, :(1 + 2)))))))
The above is technically correct, since this is the expression that would evaluate to the original one — the $(...) syntax interpolates its result, which is constructed using Expr.
Perhaps a more compact way of printing is possible, but I kind of like this one as it shows the full structure.
What do you mean by “full structure”?
I don’t see anything missing from Expr(:quote, Expr(:quote, :(1 + 2))).
You might like the printing of Meta.show_sexpr a bit better:
julia> Meta.show_sexpr( :(:(:(1+2))))
(:quote, (:quote, (:call, :+, 1, 2)))
I think that generally show_unquoted_quote_expr tries to print an expression that “looks like” a canonical form. I agree that here it could be improved here for the Expr blocks. Perhaps open an issue?