> On Oct 15, 2016, at 8:34 PM, Dave Abrahams via swift-evolution 
> <swift-evolution@swift.org> wrote:
> on Fri Oct 14 2016, Paul Cantrell <swift-evolution@swift.org 
> <mailto:swift-evolution@swift.org>> wrote:
>> A late-arriving strong +1 for me. The index-related stuff is elegant and 
>> much needed. I’m surprised
>> to learn that dict.keys and dict.values are copies and not already
>> views! 
> They are views.

Oh, OK. I stand … er, type … corrected! I was thinking of this bit of the 

> this approach requires a linear search through a dictionary's keys to find a 
> match.
> if dict.keys.contains("one") {
I had wrongly assumed in the past that contains() would forward to an efficient 
lookup against the underlying dictionary. That’s what surprised me. It clearly 
deserves fixing.

>From that, I made the incorrect leap to assuming that dict.keys made a copy. 
>On more careful rereading and a visit to the docs for LazyMapCollection, the 
>problem is much clearer to me now! Thanks as always for setting me right on 
>the details.

Cheers, P

swift-evolution mailing list

Reply via email to