I think this comment still stands 
https://github.com/JuliaLang/julia/pull/8521#discussion_r18476175

Dict comprehension syntax has not been deprecated yet, since we don't have 
> an efficient replacement. It will be Dict( i => f(x) for i = 1:10 ). 
> However the old syntax at least has to keep working (with a warning) 
> through 0.4.


That is, this new syntax hasn't been made to work yet but when it lands 
(before 0.4's release), the syntax you mention will be depreciated. Maybe 
in 0.5 or beyond it will be a Vector{Pair}.

On Monday, 16 March 2015 00:04:00 UTC-7, Jim Garrison wrote:
>
> Thank you for the reply. 
>
> I do find this unsatisfying, because by the same logic I would expect 
> `[i=>i for i in 1:2]` to create an array of pairs in the future.  But 
> the syntax currently creates a dictionary and does not seem to be 
> deprecated.  In fact, there seems to be no dict comprehension syntax 
> consistent with the new dict construction syntax (i.e. that uses 
> `Dict`), as far as I can tell. 
>
>
> On 03/15/2015 11:55 PM, Tamas Papp wrote: 
> > I think that in 0.4, => is not merely syntax, but a constructor for a 
> > Pair. So you can do 
> > 
> > julia> [Pair(i,2*i) for i = 1:3] 
> > 3-element Array{Pair{Int64,Int64},1}: 
> >  1=>2 
> >  2=>4 
> >  3=>6 
> > 
> > and using the => is just syntactic sugar. 
> > 
> > My understanding that [1=>2, 3=>4] is deprecated because it will 
> > eventually construct [Pair(1,2), Pair(3,4)] to be consistent. 
> > 
> > (type1=>type2)[...] comprehensions are syntactic sugar for creating 
> > Dicts. 
> > 
> > HTH, 
> > 
> > Tamas 
> > 
> > On Mon, Mar 16 2015, Jim Garrison wrote: 
> > 
> >> Bumping this since I am still curious and have been unable to figure 
> out 
> >> the answer. 
> >> 
> >> Is intentional that dict comprehensions (and typed dict comprehensions) 
> >> still use the old syntax for dictionaries? 
> >> 
> >>     julia> (Int=>Int)[i=>i for i in 1:2] == Dict{Int,Int}(1=>1, 2=>2) 
> >>     true 
> >> 
> >> On Thursday, March 12, 2015 at 9:08:56 AM UTC-7, Jim Garrison wrote: 
> >>> 
> >>> It is well known that the dict syntax in 0.4 has changed 
> >>> 
> >>>      julia> [1=>2,3=>4] 
> >>>      WARNING: deprecated syntax "[a=>b, ...]". 
> >>>      Use "Dict(a=>b, ...)" instead. 
> >>> 
> >>> However, I was surprised to notice that a similar syntax still works 
> for 
> >>> dict comprehensions, without warning: 
> >>> 
> >>>      julia> [i => 2i for i = 1:3] 
> >>>      Dict{Int64,Int64} with 3 entries: 
> >>>        2 => 4 
> >>>        3 => 6 
> >>>        1 => 2 
> >>> 
> >>> Is this intentional? 
> >>> 
>

Reply via email to