[swift-evolution] [Review #2] SE-0161: Smart KeyPaths: Better Key-Value Coding for Swift

Brent Royal-Gordon brent at architechies.com
Sat Apr 8 23:40:04 CDT 2017

> On Apr 8, 2017, at 9:12 PM, Tony Allevato via swift-evolution <swift-evolution at swift.org> wrote:
> `\(Foo.bar)` looks like it would try to evaluate `Foo.bar` first and then compute the "keypath" of that, which doesn't make sense, whereas `(\Foo.bar)` makes it clear that the keypath expression is being separated from whatever might come after it.

Backing this up: It's also worth remembering that this syntax is an edge case. The vast majority of key paths will not be ambiguous in a way that requires parentheses. Even if you think \(Foo.bar) would look better than (\Foo.bar), you should keep in mind that most of the time, you'll only need \Foo.bar, and the parenthesized syntax should be a natural extension of that. 

Brent Royal-Gordon
Sent from my iPhone

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170408/add25f7d/attachment.html>

More information about the swift-evolution mailing list