<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 7:05 PM, Joe Groff &lt;<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><span 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;" class="">KeyPath objects themselves have properties, so key1 could be a member of KeyPath. This doesn't seem workable.<span class="Apple-converted-space">&nbsp;</span></span><br 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;" class=""></div></blockquote></div><div class=""><br class=""></div><div class="">Yeah, someone pointed that out to me privately. One solution would be to make it so that an uninterrupted chain of property and subscript references is treated as constructing a key path, but parenthesizing ends the key path construction and accesses its properties instead:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>#keyPath(Person).friends[0].name<span class="Apple-tab-span" style="white-space:pre">                </span>// Key path to the `name` property of a `Person`</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>(#keyPath(Person).friends[0]).name<span class="Apple-tab-span" style="white-space:pre">        </span>// Value of the `name` property of a `WritableKeyPath&lt;Person, Person&gt;`</div><div class=""><br class=""></div><div class="">Optional chaining behaves the same way, and in practice it seems to work fine.</div><div class=""><br class=""></div><div class="">In practice, I'm not sure this would come up very often, because I don't think you're likely to construct a key path and immediately start calling properties on it. But it is a concern.</div><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 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=""></body></html>