> Le 8 juin 2017 à 20:17, Gwendal Roué <gwendal.r...@gmail.com> a écrit :
> 
> This gives us the ability to deal with unfitted function signatures. For 
> example, most Dictionary methods. Yes, they are usually unfitted:
> 
>     extension Dictionary {
>         func forEach(_ body: ((key: Key, value: Value)) throws -> Void) 
> rethrows
>     }
> 
> Who cares about this named (key:value:) tuple? Absolutely nobody, as 
> exemplified by this remarquable Swift 3 snippet below, where no tuple, no 
> `key`, and no `value` is in sight:
> 
>     let scores: [String: Int] = ... // [playerName: score]
>     scores.forEach { name, score in
>         print("\(name): \(score)")
>     }
> 
> Do you see?

I regret my "Absolutely nobody" snippet. Some people like the `key` and `value` 
identifiers.

Those people are the people who write the standard library, people who write 
blog posts about Swift novelties, and people who write experimental software 
around Swift. All very valuable people.

There are other kinds of developers, who don't really care about the beauty of 
dictionary design and implementation. They just want a container that does what 
it's supposed to do: map stuff to other stuff. Not keys to values.

To them, a dictionary is like a screwdriver: when you use it, you don't want to 
think about it much.

And the recent changes force us to see uninteresting implementation details 
that obscure everyday code.

Gwendal

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to