<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="">Here's some hypothetical code example. &nbsp;Let suppose an extension on key paths allows us to invoke desc and asc to help create sort orderings. &nbsp;This is what it would look using the two different notations:<div class=""><br class=""><div class=""><font face="Monaco" color="#009400" class=""><span style="font-size: 12px;" class="">// Order by totalAmount descending, then by address.zip ascending<br class=""></span></font><div class=""><div class=""><font face="Monaco" class=""><span style="font-size: 12px;" class="">let&nbsp;orderings = [ (</span></font><span style="font-family: Monaco; font-size: 12px;" class="">\</span><font face="Monaco" class=""><span style="font-size: 12px;" class=""><font color="#af00f4" class="">Order.totalAmount</font>).desc, &nbsp;(</span></font><span style="font-family: Monaco; font-size: 12px;" class="">\</span><font face="Monaco" class=""><span style="font-size: 12px;" class=""><font color="#af00f4" class="">Order.address.zip</font>).asc ]</span></font></div><div class=""></div><div class=""><font face="Monaco" class=""><span style="font-size: 12px;" class="">let&nbsp;orderings = [&nbsp;</span></font><span style="font-family: Monaco; font-size: 12px;" class="">\</span><span style="color: rgb(175, 0, 244); font-family: Monaco; font-size: 12px;" class="">Order.totalAmount</span><span style="font-family: Monaco; font-size: 12px;" class="">\</span><font face="Monaco" class=""><span style="font-size: 12px;" class="">.desc, &nbsp;</span></font><span style="font-family: Monaco; font-size: 12px;" class="">\</span><span style="color: rgb(175, 0, 244); font-family: Monaco; font-size: 12px;" class="">Order.address.zip</span><span style="font-family: Monaco; font-size: 12px;" class="">\</span><font face="Monaco" class=""><span style="font-size: 12px;" class="">.asc ]</span></font></div><div class=""><br class=""></div></div><div class="">The second one saves one character every time you want to invoke a method on the key path but I would have to go back and add the left parenthesis, which could be a bit annoying as I'm typing these things in, unless the editor were to come to the rescue add the left parenthesis automatically somehow. &nbsp;But anyways, I can go with either one.</div><div class=""><br class=""></div><div class="">Still +1 on the proposal. &nbsp;:-)</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Apr 5, 2017, at 11:13 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 14px; 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;" class="">On Wed, Apr 5, 2017 at 9:21 PM, Ricardo Parada via swift-evolution<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><span class="gmail-"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 5, 2017, at 9:41 PM, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="gmail-m_-7606062616642485556Apple-interchange-newline"><div class=""><span style="font-family: helvetica; font-size: 14px; 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; float: none; display: inline;" class="">It's worth noting that, if you write `\Person.name.valueType`, this syntax is ambiguous—it could mean "make a key path for the `valueType` property on `name` property of `Person`", or it could mean "make a key path for the `name` property of `Person`, then access the key path's `valueType` property". We can solve this by always interpreting it as the former and requiring parentheses for the latter—that is, `(\Person.name).valueType`—but I thought it was worth calling out explicitly.</span><br class="gmail-m_-7606062616642485556Apple-interchange-newline"></div></blockquote></div><br class=""></span><div class="">Good point.&nbsp;</div><div class=""><br class=""></div><div class="">&nbsp;I'm thinking about the hypothetical code examples from previous emails:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class=""></div></blockquote></div><div class=""><span class="gmail-"><div class=""><font face="Monaco" style="font-size: 12px;" class="">&nbsp; &nbsp;let isPuppyQualifier =<span class="Apple-converted-space">&nbsp;</span><font color="#af00f4" class="">\Pet.type</font><span class="Apple-converted-space">&nbsp;</span>== .dog &amp;&amp;<span class="Apple-converted-space">&nbsp;</span><font color="#af00f4" class="">\Pet.age</font><span class="Apple-converted-space">&nbsp;</span>&lt; 12</font></div></span><div class=""><font face="Monaco" style="font-size: 12px;" class="">&nbsp; &nbsp;let familyQualifier =&nbsp;</font><span style="font-family: monaco; font-size: 12px;" class="">(</span><font face="Monaco" style="font-size: 12px;" class=""><font color="#af00f4" class="">\Family.pets</font></font><span style="font-family: monaco; font-size: 12px;" class="">)</span><font face="Monaco" style="font-size: 12px;" class="">.contains(<wbr class="">where: isPuppyQualifier)</font></div><span class="gmail-"><div class=""><font face="Monaco" style="font-size: 12px;" class="">&nbsp; &nbsp;let familiesWithPuppies = Family.fetch(editingContext, familyQualifier)</font></div></span></div><div class=""><div class=""><br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">That's an interesting point. While `\` alone seems acceptable, I think it's unfortunate that we'll have `(\...)` and `\(...)` both in the language.</div><div class="">Can we maybe consider instead:</div><div class=""><br class=""></div><div class=""><div class=""><span class="gmail-Apple-tab-span" style="white-space: pre;">        </span>let firstFriendsNameKeyPath = \Person.friends[0].name\</div><div class=""><br class=""></div><div class="">It is also worth mentioning that, with the sigil, the `keyPath` label may not be so necessary:</div><div class=""><br class=""></div><div class=""><span class="gmail-Apple-tab-span" style="white-space: pre;">        </span>print(luke[\.friends[0].name])</div></div><div class=""><span style="white-space: pre;" class="">        // or, if the suggestion above is accepted</span><br class=""></div><div class=""><span style="white-space: pre;" class="">        print(luke[\.friends[0].name\])</span></div></div></div></div></div></blockquote></div><br class=""></div></div></div></body></html>