<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Sent from my iPhone</div><div><br>On Mar 29, 2017, at 6:32 PM, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div><blockquote type="cite" class=""><div class="">On Mar 29, 2017, at 6:21 PM, Jonathan Hull via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; 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. &nbsp;I'm working on a library where users will specify a collection of key paths pairs. &nbsp;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. &nbsp;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. &nbsp;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></div></blockquote><div><br></div>To me, this reads as if you're accessing ".key1.key2" on the KeyPath instance, not forming a keypath. I think the whole "path" should say in the parens.&nbsp;<div><br></div><div>&nbsp; - Doug</div><div><br><blockquote type="cite"><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="">--&nbsp;</div><div style="font-size: 12px; " class="">Brent Royal-Gordon</div><div style="font-size: 12px; " class="">Architechies</div></div></span>

</div>
<br class=""></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></body></html>