With one element only, type inference gives:

julia> typeof(Dict(sin => sin))
Dict{Base.#sin,Base.#sin}


On Thursday, October 13, 2016 at 9:26:37 AM UTC+2, David van Leeuwen wrote:
>
> Hello, 
>
> I have stumbled across the following type inference issue for `Dict`s in 
> julia-v0.5:
>
> julia> typeof(Dict(sin => sin, cos => cos))
>
> Dict{Any,Any}
>
> julia> typeof(Dict(x => x for x in [sin, cos]))
>
> Dict{Function,Function}
>
> In Julia-0.5, functions got their own type.  I was surprised to see that 
> the type inference in the `Dict(:a => sin, :b => cos)` for the value of the 
> dict is `Any` and not `Function`.  In the comprehension syntax, the type of 
> the value _is_ generalised to `Function`.  
>
> Is this intended behavior?
>
>
>

Reply via email to