<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On 8 Apr 2017, at 22:18, BJ Homer 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=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""><span class=""></span></div><div class=""><div class=""><span class=""></span></div><div class=""><div class="">I love the idea of a leading and trailing backslash. It makes it much easier to read, and handles the "but what if I want to access a property of a KeyPath?" case really well.</div><div class=""><br class=""></div><div class="">For example, these two are clearly distinct:</div><div class=""><br class=""></div><div class=""> let x = \<span style="background-color: rgba(255, 255, 255, 0);" class="">Person.mother.age\.valueType</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""> let y = \Person.mother.age.valueType\</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">I'm not sure why an 'age' object would have a 'valueType' property, but this variant makes it easy to handle. Even in cases where no disambiguation is required, having the trailing backslash makes it much easier to read as I'm scanning through code.</span></div><div class=""><br class=""></div><div class="">-BJ</div></div></div></div></div></blockquote><br class=""></div><div>I think I'd prefer brackets for that case; in your first example that reads to me like an escape of the period character, rather than "this is the end of the key path". Brackets would make this consistent with escaping within strings, like so:</div><div><br class=""></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let x = \(Person.mother.age).valueType</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let y = \(Person.mother.age.valueType)</font></div><div><br class=""></div><div>Which makes sense to me if you consider the backslash in this case being an escape from normal type/variable access. Put another way, normally when you type Person. you're telling Swift "access this type and look for static methods/properties etc.", whereas when you "escape" it you're telling Swift to <b class="">not</b> to do that, resulting in a key-path instead.</div><div><br class=""></div><div>Maybe it's a stretch, it that makes sense logically to me, plus I think the use of brackets just looks cleaner than another backslash.</div></body></html>