Vector of dictionaries of different types in julia 0.6

Viewed 635

I am a bit confused about the new where syntax in julia 0.6. I have something like this:

a=Dict(["a"=>"b"])
b=Dict(["a"=>3])
c=Dict(["a"=>"c"])

I want a function that receive a vector of dictionaries without having to make an explicit conversion. I tried with:

function bbb(a::Vector{Dict{String, Any}})
     println(a)
end

And it didn't work.

Then I tried with

function bbb(a::Vector{Dict{String, T} where T})
     println(a)
end
bbb([a,b])   #Works
bbb([a,c])   #Fails
bbb([a,b,c]) #Works

I have overloaded bbb with every combination that I can recieve in order to make an explicit conversion. But I'm still wondering how is the proper way to do it.

1 Answers
Related