<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
On Dec 18, 2017, 4:53 PM -0800, Douglas Gregor via swift-dev <swift-dev@swift.org>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">Hi all,
<div class=""><br class="" /></div>
<div class="">A little while back, I added an error to the Swift 4.1 compiler that complains if one tries to use conditional conformances, along with a flag “-enable-experimental-conditional-conformances” to enable the feature. We did this because we haven’t implemented the complete proposal yet; specifically, we don’t yet handle dynamic casting that involves conditional conformances, and won’t in Swift 4.1.</div>
<div class=""><br class="" /></div>
<div class="">I’d like to take away the "-enable-experimental-conditional-conformances” flag and always allow conditional conformances in Swift 4.1, because the changes in the standard library that make use of conditional conformances can force users to change their code *to themselves use conditional conformances*. Specifically, if they had code like this:</div>
<div class=""><br class="" /></div>
<blockquote style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;" class="">
<div class=""><font face="Menlo" class="">extension MutableSlice : P { }</font></div>
<div class=""><font face="Menlo" class="">extension MutableBidirectionalSlice : P { }</font></div>
<div class=""><font face="Menlo" class="">// …</font></div>
</blockquote>
<div class=""><br class="" /></div>
<div class="">they’ll get an error about overlapping conformances, and need to do something like the following to fix the issue:</div>
<div class=""><br class="" /></div>
<blockquote style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;" class="">
<div class=""><font face="Menlo" class="">extension Slice: P where Base: MutableCollection { }</font></div>
</blockquote>
<div class=""><br class="" /></div>
<div class="">which is way more elegant, but would require passing "-enable-experimental-conditional-conformances”. That seems… unfortunate… given that we’re forcing them to use this feature.</div>
<div class=""><br class="" /></div>
<div class="">My proposal is, specifically:</div>
<div class=""><br class="" /></div>
<div class="">
<ul class="MailOutline">
<li class="">Allow conditional conformances to be used in Swift 4.1 (no flag required)</li>
<li class="">Drop the -enable-experimental-conditional-conformances flag entirely</li>
<li class="">Add a runtime warning when an attempt to dynamic cast fails due to a conditional conformance, so at least users know what’s going on</li>
</ul>
</div>
<div class=""> </div>
</blockquote>
<div><br /></div>
<div>The last bullet doesn’t feel right to me.  It sounds like we would ship a feature that we know only partially works, but issue a runtime warning in the case we know isn’t fully implemented?  I’m I interpretting that point correctly?</div>
<div><br /></div>
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">
<div class="">Thoughts?</div>
<div class=""><br class="" /></div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>- Doug</div>
<div class=""><br class="" /></div>
_______________________________________________<br />
swift-dev mailing list<br />
swift-dev@swift.org<br />
https://lists.swift.org/mailman/listinfo/swift-dev<br /></blockquote>
<div></div>
</div>
</body>
</html>