# Unknown warntype from Expr()

**URL:** <https://discourse.julialang.org/t/unknown-warntype-from-expr/43431>\
**Category:** New to Julia\
**Created:** [July 21, 2020, 12:52pm UTC](https://discourse.julialang.org/t/unknown-warntype-from-expr/43431 "2020-07-21T12:52:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [July 21, 2020, 12:52pm UTC](https://discourse.julialang.org/t/unknown-warntype-from-expr/43431/1 "2020-07-21T12:52:47Z")

</div>

the following function:

```julia
function symident(n::Int)
    rows = Vector{Expr}(undef, n)
    temp = zeros(Int, n)
    for i in Base.OneTo(n)
        temp[i] = 1
        rows[i] = Expr(:row, temp...)
        temp[i] = 0
    end

    return Expr(:vcat, rows...)
end

```

gives warntypes that I don’t understand:

```julia
julia> @code_warntype symident(3)
Body::Any
│ %23 = Core._apply(Main.Expr, %22, temp)::Any
│ %32 = Core._apply(Main.Expr, %31, rows)::Any
└── return %32

```

seems like there’s some problem using the splatting operator `...` ?  
please help. thanks.

---

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [July 22, 2020, 3:06am UTC](https://discourse.julialang.org/t/unknown-warntype-from-expr/43431/2 "2020-07-22T03:06:43Z")

</div>

minimal working examples:

```julia
f1() = (v = [:a, :b]; Expr(:row, v...) )
f2() = (v = [Expr(:call, :+, 1, 1), Expr(:call, :+, 2, 2)]; 
        Expr(:row, v...) )
f3() = (v = [1, 2]; Expr(:row, v...) )
f4() = (v = [1, 2]; Expr(:vcat, v...) )

julia> @code_warntype f1()
julia> @code_warntype f2()
julia> @code_warntype f3()
julia> @code_warntype f4()

```

all functions `f1()` to `f4()` give warntypes.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 22, 2020, 8:07am UTC](https://discourse.julialang.org/t/unknown-warntype-from-expr/43431/3 "2020-07-22T08:07:49Z")

</div>

I am not sure what you are expecting here, since `Expr` has its `args` in a `Vector{Any}`:

```julia
julia> dump(Expr)
Expr <: Any
  head::Symbol
  args::Array{Any,1}

```

Since the primary use case for manipulating `Expr`s is metaprogramming, this is intentional.

---

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [July 22, 2020, 9:02am UTC](https://discourse.julialang.org/t/unknown-warntype-from-expr/43431/4 "2020-07-22T09:02:54Z")

</div>

> [@Tamas\_Papp](#):
>
> since `Expr` has its `args` in a `Vector{Any}` :

oh, I supposed that `args` should be, e.g. in `Vector{Int}` for `f4()`.

that said, does those warntypes has performance overhead? or, could I just ignore all warntypes involving expressions and symbols? thanks.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 22, 2020, 9:19am UTC](https://discourse.julialang.org/t/unknown-warntype-from-expr/43431/5 "2020-07-22T09:19:44Z")

</div>

> [@tomtom](#):
>
> that said, does those warntypes has performance overhead?

Compared to what?

> [@tomtom](#):
>
> ignore all warntypes involving expressions and symbols?

Possibly yes, but if your use case is metaprogramming, they should be irrelevant anyway.

Are you optimizing metaprogramming code? Having some context would help.

---

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [July 22, 2020, 9:53am UTC](https://discourse.julialang.org/t/unknown-warntype-from-expr/43431/6 "2020-07-22T09:53:11Z")

</div>

I’m trying to use `Reduce.jl` to help generating some complicated equations (that I could not completed by hands). Anyway, I think the warntype overhead is very small compared to those used in working with the `REDUCE CSL`.
