# Quote expressions

**URL:** <https://discourse.julialang.org/t/quote-expressions/27584>\
**Category:** New to Julia\
**Tags:** metaprogramming\
**Created:** [August 15, 2019, 2:23pm UTC](https://discourse.julialang.org/t/quote-expressions/27584 "2019-08-15T14:23:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dito](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dito/32/10039_2.png) [@Dito](https://discourse.julialang.org/u/Dito)\
**Post date:** [August 15, 2019, 2:23pm UTC](https://discourse.julialang.org/t/quote-expressions/27584/1 "2019-08-15T14:23:19Z")

</div>

I can’t understand True and False outputs

```julia
julia> x=:(1+2);

julia> e₁=quote quote $x end end
quote
    #= REPL[2]:1 =#
    $(Expr(:quote, quote
    #= REPL[2]:1 =#
    $(Expr(:$, :x))
end))
end

julia> eval(e₁)
quote
    #= REPL[2]:1 =#
    1 + 2
end

julia> eval(eval(e₁))
3

julia> e₂=quote 1+2 end
quote
    #= REPL[5]:1 =#
    1 + 2
end

julia> eval(e₂)
3

julia> eval(e₁)==e₂
false

julia> eval(eval(e₁))==eval(e₂)
true

julia> eval(e₁)== quote
         #= REPL[2]:1 =#
         1 + 2
       end
false

julia> eval(e₁)
quote
    #= REPL[2]:1 =#
    1 + 2
end

julia> Expr(:quote,:(1+2))==:($(Expr(:quote, :(1 + 2))))
true

```

---

<div class="post-metadata">

**Author:** ![snobis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/snobis/32/9939_2.png) [@snobis](https://discourse.julialang.org/u/snobis)\
**Post date:** [August 15, 2019, 2:36pm UTC](https://discourse.julialang.org/t/quote-expressions/27584/2 "2019-08-15T14:36:44Z")

</div>

All quoted expressions contain a reference to the source line of their definition. Here is a simpler example:

```julia
julia> a = quote 1 + 2 end
quote
    #= REPL[1]:1 =#
    1 + 2
end

julia> b = quote 1 + 2 end
quote
    #= REPL[2]:1 =#
    1 + 2
end

julia> a == b
false

julia> quote 1 + 2 end == quote 1 + 2 end
true

```

So if the quoted expressions are defined on the same line they are indeed equal, but if they are defined on different lines, like `a` and `b` or your `eval(e₁)` and `e₂`, then the essential part (the inner expression) is the same, but not the complete expression objects.

On the other hand your `eval(eval(e₁))` and `eval(e₂)` both evaluate to 3 and 3 equals 3, so everything is fine.
