<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 Nov 28, 2017, at 8:57 PM, Slava Pestov <<a href="mailto:spestov@apple.com" class="">spestov@apple.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; line-break: after-white-space;" class="">Hi Chris,<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Nov 28, 2017, at 8:54 PM, Chris Lattner 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=""><div 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="">“post.author" always invokes the DynamicMemberLookupProtocol proposal.</div><div 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="">“post.author()” would invoke the “DynamicCallableWithKeywordsToo” hook in the dynamic callable proposal:</div><div 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=""><a href="https://gist.github.com/lattner/a6257f425f55fe39fd6ac7a2354d693d" class="">https://gist.github.com/lattner/a6257f425f55fe39fd6ac7a2354d693d</a></div></div></blockquote></div><br class=""><div class="">Elsewhere in Swift, it is generally the case that</div><div class=""><br class=""></div><div class="">foo.bar()</div><div class=""><br class=""></div><div class="">is equivalent to</div><div class=""><br class=""></div><div class="">let fn = foo.bar</div><div class="">fn()</div></div></div></blockquote><div><br class=""></div><div>That’s not actually the generally the case once you include some keyword arguments in the call. Recall that function types don’t have keyword argument labels any longer, so:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>foo.bar(x: 42)</div><div><br class=""></div><div>Is not equivalent to:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>let fn = foo.bar</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>fn(x: 42)</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Would this equivalence still hold with your proposal(s)?</div></div></div></blockquote><br class=""></div><div>It completely depends on the direction of the DynamicCallable proposal:</div><div><a href="https://gist.github.com/lattner/a6257f425f55fe39fd6ac7a2354d693d" class="">https://gist.github.com/lattner/a6257f425f55fe39fd6ac7a2354d693d</a></div><div><br class=""></div><div>In my original proposal, I had no hook for “DynamicCallableWithKeywordsToo”. Feedback from the list was that people care about smalltalk derived languages (Ruby, Squeak, and yes, ObjC/Swift) and so I added this as a generalization.</div><div><br class=""></div><div>That said, I’m not attached to it at all. I can see the advantages of supporting these forms, but I can also see the concern that you’re observing.</div><div><br class=""></div><div>I think that proponents for “DynamicCallableWithKeywordsToo” would say that Smalltalky languages (including Swift per the example above) do not provide the ability to separate out the base name, and those a bridge to those language can justifiably eject this concern. In contrast, since Python *does* allow the substitution that you’re suggesting, its bridge absolutely would provide that capability.</div><div><br class=""></div><div>In the end, it comes down to the cost benefit tradeoff we’ll have to weigh: how much generality and power is needed and can be justified?</div><div><br class=""></div><div>-Chris</div><br class=""></body></html>