Re: [swift-evolution] Be able to initialise empty dict with array constrcutor

2016-01-05 Thread Alexander Kempgen via swift-evolution
Yes. All of these variants are covered in the book The Swift Programming Language in some detail. Alex – Alexander Kempgen a...@kempgen.de > Am 05.01.2016 um 14:42 schrieb James Campbell via swift-evolution > : > > So the [Int]() is shorthand for Array() > >

Re: [swift-evolution] Be able to initialise empty dict with array constrcutor

2016-01-05 Thread Jeremy Pereira via swift-evolution
> On 5 Jan 2016, at 13:42, James Campbell wrote: > > So the [Int]() is shorthand for Array() Yes. In general, you can write [T] anywhere you can write Array and [U : V] anywhere you can write Dictionary. The are both syntactic sugar. > > On Tue, Jan 5, 2016 at

Re: [swift-evolution] Be able to initialise empty dict with array constrcutor

2016-01-05 Thread James Campbell via swift-evolution
Thats a small but huge improvement :) On Tue, Jan 5, 2016 at 6:58 PM, Chris Lattner wrote: > You’re completely right, but we don’t need to change the swift language to > fix that. As of 3f19714, which I just pushed, we now emit this error > message (which includes a fixit

Re: [swift-evolution] Be able to initialise empty dict with array constrcutor

2016-01-05 Thread James Campbell via swift-evolution
Perhaps instead of "auto" we could allow "lazy" to create a default lazy constructor for these cases ? On Tue, Jan 5, 2016 at 12:39 PM, James Campbell wrote: > See this code: > > var distanceCache: [Int: Int] = Dictionary() > It is very long and tedious to write

Re: [swift-evolution] Be able to initialise empty dict with array constrcutor

2016-01-05 Thread Jeremy Pereira via swift-evolution
I don’t understand what the problem is > On 5 Jan 2016, at 12:39, James Campbell via swift-evolution > wrote: > > See this code: > var distanceCache: [Int: Int] = Dictionary() > > It is very long and tedious to write especially if what I am storing

Re: [swift-evolution] Be able to initialise empty dict with array constrcutor

2016-01-05 Thread James Campbell via swift-evolution
The problem for me is that is so counter intuitive I didn't even know you could do that. On Tue, Jan 5, 2016 at 12:50 PM, Jeremy Pereira < jeremy.j.pere...@googlemail.com> wrote: > I don’t understand what the problem is > > > On 5 Jan 2016, at 12:39, James Campbell via swift-evolution < >