<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><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></body></html>