<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><span></span></div><div><br><div class="AppleOriginalContents" style="direction: ltr;"><blockquote type="cite"><div>On Jan 3, 2016, at 6:48 AM, Антон Жилин via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr" class=""><div style="font-size:12.8px" class="">Introduction of interfaces will clean up the current blend of static and dynamic protocols, and solve at least three popular issues.</div><div style="font-size:12.8px" class="">Please see:</div><div style="font-size:12.8px" class=""><a href="https://github.com/Anton3/swift-evolution/blob/master/proposals/0000-introducing-interfaces.md">https://github.com/Anton3/swift-evolution/blob/master/proposals/0000-introducing-interfaces.md</a></div></div></div></blockquote><div class="AppleOriginalContents" style="direction: ltr;"><br></div>I am *completely* against this proposal.</div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;">Fundamentally, you're trying to address the limitation that protocols with Self or associated type requirements can't be existential. But it's just a limitation that isn't (conceptually) that hard to fix: the primary operation you need to work with an existing of such a protocol is to "open" a value of existential type, giving a name to the dynamic type it stores. Let's invent one:</div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;"> func eq(x: Equatable, y: Equatable) -> Bool {</div><div class="AppleOriginalContents" style="direction: ltr;"> // give the name T to the dynamic type stored in xT</div><div class="AppleOriginalContents" style="direction: ltr;"> let xT = open x as T</div><div class="AppleOriginalContents" style="direction: ltr;"> // is y also storing a T?</div><div class="AppleOriginalContents" style="direction: ltr;"> guard let yT = y as? T else { return false }</div><div class="AppleOriginalContents" style="direction: ltr;"> // check whether the Ts are equal</div><div class="AppleOriginalContents" style="direction: ltr;"> return xT == yT</div><div class="AppleOriginalContents" style="direction: ltr;"> }</div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;">Ignore the syntax: semantically, we've gone from a "dynamic" existential thing back to something more "static", just by giving a name to the type. Swift generics aren't really even static in any sense: what the do is give names to the types of values so one can establish relationships among different values. "open..as" would do that for existentials. </div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;">Note that ether Swift compilers AST and SIL both have "open existential" operations that do this internally. They have no spelling in Swift code, but they are useful to describe operations on existentials. At present, they cannot be formed when the existential involves a protocol with Self or associated type requirements, but that's a limitation that isn't hard to address. </div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;">As for your concerns about knowing when one can dynamically override and when one cannot... There are issues here that need to be addressed. They aren't significant enough to warrant such a drastic change, and may not even require language changes at all. </div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;"><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;"><br></div></div></body></html>