<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">I *don't* want dynamic calls to stand out. I want seamless interoperability.<div><br></div><div><pre style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; word-wrap: normal; padding: 16px; overflow: auto; line-height: 1.45; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;"><font face="UICTFontTextStyleTallBody"><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);"><span class="pl-s" style="box-sizing: border-box;">let arrayOfDogs = [ Python.Module(dog).Dog(<span class="pl-pds" style="box-sizing: border-box;">"</span></span>Brianna<span class="pl-s" style="box-sizing: border-box;"><span class="pl-pds" style="box-sizing: border-box;">"</span>), </span><span class="pl-s" style="box-sizing: border-box;">Python.Module(dog).Dog(<span class="pl-pds" style="box-sizing: border-box;">"</span></span>Kevin<span class="pl-s" style="box-sizing: border-box;"><span class="pl-pds" style="box-sizing: border-box;">"</span>) ] // Swift array of Python objects</span></span></font></pre><pre style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; word-wrap: normal; padding: 16px; overflow: auto; line-height: 1.45; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;"><font face="UICTFontTextStyleTallBody"><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);"><span class="pl-s" style="box-sizing: border-box;">let b = arrayOfDogs.sorted() // use Swift 'sort' function on Python objects (invoking Python '<' and '==' operators)</span></span></font></pre><pre style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; word-wrap: normal; padding: 16px; overflow: auto; line-height: 1.45; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;"><font face="UICTFontTextStyleTallBody"><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);"><span class="pl-s" style="box-sizing: border-box;">let c = arrayOfDogs.forEach { $0.bark() } // Swift 'forEach' calling Python 'bark'</span></span></font></pre><pre style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; word-wrap: normal; padding: 16px; overflow: auto; line-height: 1.45; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;"><font face="UICTFontTextStyleTallBody"><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);"><span class="pl-s" style="box-sizing: border-box;">etc.</span></span></font></pre><pre style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0px; word-wrap: normal; padding: 16px; overflow: auto; line-height: 1.45; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;"><font face="UICTFontTextStyleTallBody"><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);"><span class="pl-s" style="box-sizing: border-box;"><br></span></span></font></pre><br><div id="AppleMailSignature"><span style="background-color: rgba(255, 255, 255, 0);">--<br>C. Keith Ray</span><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">* <a href="https://leanpub.com/wepntk">https://leanpub.com/wepntk</a> <- buy my book?<br>* </span><a href="http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf">http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf</a><span style="background-color: rgba(255, 255, 255, 0);"><br>* <a href="http://agilesolutionspace.blogspot.com/">http://agilesolutionspace.blogspot.com/</a></span></div></div><div><br>On Dec 3, 2017, at 6:57 AM, Tino Heth via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div><br class=""><blockquote type="cite" class=""><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="">What do you think about having a special method ‘dynamic' defined in this protocol, such that the compiler magic lookup behavior is only available when chained after that method?</span></div></blockquote></div>I guess „dynamic“ isn’t a common property name, but imho such magic doesn’t feel right, even when there are no collisions in real-world code.<div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class=""><div class=""><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>let y = np^.arange?^(24)?^.reshape^?(2, 3, 4)!<br class=""></div></div></div></div></blockquote></div><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class=""><div class=""><div class="">That looks quite ugly… but imho that’s at least partially because of the choice of character</div><div class="">let y = np:arange?:reshape?:(2, 3, 4)!</div><div class="">doesn’t seem to be as bad as the use of carets.</div><div class=""><br class=""></div><div class="">But still, you would have to jump through some hoops to use both kinds of dispatch side by side (because you always have to think about how to call a method).</div><div class="">On the other hand, we also have &inoutParameter and try, which makes some things less convenient — and I’d say that dynamic dispatch is somehow comparable to inout-parameters (both shouldn’t be used if you can get around it).</div><div class=""><br class=""></div><div class="">So, why do people want differentiate?</div><div class="">I can see two major motivations for a different syntax:</div><div class=""><br class=""></div><div class="">a) you want to dynamic calls to stand out — which also could be done by tools:</div><div class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class=""><div class=""><div class="">let y = np.<b class=""><i class="">arange</i></b>?(24)?.<b class=""><i class="">reshape</i></b>?(2, 3, 4)! // let the editor use a different font/color for non-static stuff</div></div></div></div></blockquote></div><div class=""><br class=""></div><div class="">b) you want to be sure that in a given situation, no dynamic dispatch is used — which could be solved by keeping the dot as general way to call something, and add an alternative that will only use static lookup</div><div class=""><br class=""></div><div class="">No matter what direction is taken here, imho this whole story has a really gigantic impact on the shape of Swift, and I have strong concerns if the two changes are reviewed in a normal way and added this year… there’s no experience with the proposed changes yet, and afaics, it has become quite hard to correct additions that turn out to be not as positive as expected.</div><div class=""><br class=""></div><div class="">- Tino</div><div class=""><br class=""></div></div></div></div></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></body></html>