<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On Mar 29, 2017, at 6:21 PM, Jonathan Hull via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">I would love it if we found a way to retain something as concise as that shorthand. I'm working on a library where users will specify a collection of key paths pairs. This shorthand would be a very nice piece of sugar making the code expressing these collections (usually literals) quite a bit more readable.</span></div></blockquote></div><br class=""><div class="">+1 for this. I think it will be somewhat common to pass around arrays of these things, and a shorthand syntax of some sort would make that nicer. That said, I don’t want to slow down the proposal, since I will be using this feature the very second it becomes available.</div></div></div></blockquote><br class=""></div><div>Agreed.</div><div><br class=""></div><div>One more thought on this: I don't think anyone really likes the #keyPath(Type, .key1.key2)` syntax; it's just the best we've come up with. If the syntax were instead this:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>#keyPath(Type).key1.key2</div><div><br class=""></div><div>I think that would look cleaner and avoid drawing distinctions based on subtle punctuation differences. I don't think it would clash with old-style key paths since you can't have a key path to a type name anyway. And support for the leading-dot syntax would fall out of it quite naturally.</div><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-east-asian: normal; font-variant-position: normal; line-height: normal; border-spacing: 0px;"><div class=""><div style="font-size: 12px; " class="">-- </div><div style="font-size: 12px; " class="">Brent Royal-Gordon</div><div style="font-size: 12px; " class="">Architechies</div></div></span>
</div>
<br class=""></body></html>