Is it a good idea to avoid Channel{Any} and how to avoid it?

Hello,

I have the following code

ljulia> lst_a = [1, 2, 3, 4]
4-element Array{Int64,1}:
 1
 2
 3
 4

julia> lst_b = [10.1, 11.1, 12.1, 13.1]
4-element Array{Float64,1}:
 10.1
 11.1
 12.1
 13.1

julia> function generator()
           Channel() do channel
               for (a, b) in zip(lst_a, lst_b)
                   t = (a=a, b=b)
                   put!(channel, t)
               end
           end
       end
generator (generic function with 1 method)

julia> g = generator()
Channel{Any}(sz_max:0,sz_curr:1)

julia> for t in g
           println(t)
           println(typeof(t))
       end
(a = 1, b = 10.1)
NamedTuple{(:a, :b),Tuple{Int64,Float64}}
(a = 2, b = 11.1)
NamedTuple{(:a, :b),Tuple{Int64,Float64}}
(a = 3, b = 12.1)
NamedTuple{(:a, :b),Tuple{Int64,Float64}}
(a = 4, b = 13.1)
NamedTuple{(:a, :b),Tuple{Int64,Float64}}

julia> g = generator()
Channel{Any}(sz_max:0,sz_curr:1)

julia> collect(g)
4-element Array{Any,1}:
 (a = 1, b = 10.1)
 (a = 2, b = 11.1)
 (a = 3, b = 12.1)
 (a = 4, b = 13.1)

g is Channel{Any}(sz_max:0,sz_curr:1)

I often read that using Any is bad because of performance issue in Julia, so I wonder if that’s the case here (I want to mimic a Python yield) but I haven’t been able to avoid it.

I tried to do something like

    Channel{NamedTuple}() do channel
        ...
    end

or even more “precise”

    Channel{NamedTuple{(:a, :b),Tuple{Int64,Float64}}}() do channel
        ...
    end

but it doesn’t work.

So… I wonder if it’s a really a good idea to avoid Channel{Any} and how to avoid it?

Kind regards