<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 17, 2017, at 3:04 PM, BJ Homer <<a href="mailto:bjhomer@gmail.com" class="">bjhomer@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">So then this would be disambiguated like this?<div class=""><br class=""></div><div class=""><font face="Menlo" class="">let staticValue = Foo.bar // Defaults to accessing the static value, when there is ambiguity</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">let value: Bar = Foo.bar</font></div><div class=""><font face="Menlo" class="">let keyPath: WritableKeyPath<Foo, Bar> = Foo.bar</font></div><div class=""><br class=""></div><div class="">It’s a little unfortunately to have to spell out <font face="Menlo" class="">WritableKeyPath<Foo, Bar></font> there, but as long as there’s some way to do it, I don’t think it’s a problem. This is likely a rare edge case.</div></div></div></blockquote><div><br class=""></div><div>You could also just write `: WritableKeyPath` and let the generic arguments be deduced. I agree that, in most situations you want a key path, you'll likely have type context that picks the right thing.</div><div><br class=""></div><div>-Joe</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">-BJ Homer</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 17, 2017, at 3:56 PM, Joe Groff <<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div 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-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Mar 17, 2017, at 2:53 PM, Michael LeHew <<a href="mailto:lehewjr@apple.com" class="">lehewjr@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space;"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 17, 2017, at 2:21 PM, BJ Homer <<a href="mailto:bjhomer@gmail.com" class="">bjhomer@gmail.com</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;">This looks great!<div class=""><br class=""></div><div class="">What happens in the case when there is a static property by the same name as an instance property? e.g.</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">struct Foo {</font></div><div class=""><font face="Menlo" class=""> static var bar: Bar</font></div><div class=""><font face="Menlo" class=""> var bar: Bar</font></div><div class=""><font face="Menlo" class="">}</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">Foo.bar // What is this?</font></div><div class=""><br class=""></div><div class="">Is it still possible to reference both the static property and a KeyPath to the instance method? </div></div></div></blockquote><div class=""><br class=""></div>This is essentially the same question that I arrived at in my reply to Vladimir. I think Joe might be best able to answer here.</div></div></div></blockquote><br class=""></div><div 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-stroke-width: 0px;" class="">We already encounter this situation with static vs instance methods, since `Foo.bar` can refer to either a static method `bar` or an unbound instance method `bar`. We use type context to disambiguate, favoring the static member if context doesn't help:</div><div 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-stroke-width: 0px;" class=""><br class=""></div><div 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-stroke-width: 0px;" class=""><div class="">struct X {</div><div class=""> static func foo() {}</div><div class=""> func foo() {}</div><div class="">}</div><div class=""><br class=""></div><div class="">let foo1 = X.foo // Defaults to static member</div><div class="">let foo2: () -> () = X.foo // Picks static member by type context</div><div class="">let foo3: (X) -> () -> () = X.foo // Picks instance member by type context</div><div class=""><br class=""></div><div class="">-Joe</div></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></body></html>