<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Sent from my iPad</div><div><br>On Feb 15, 2017, at 8:17 PM, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 13, 2017, at 09:33, Matthew Johnson via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Feb 13, 2017, at 11:28 AM, James Froggatt via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class="">Having loosely followed this discussion, the way I'm thinking of ‘closed’ is as a modifier which would let you switch over something from outside the module in which it is declared.<br class=""><br class="">From outside the declaring module:<br class="">• A closed enum's cases can be exhaustively switched.<br class="">• A closed protocol's conforming types can be exhaustively switched.<br class="">• A closed class's subclasses can be exhaustively switched.<br class=""><br class="">If this is correct, I can't help but think ‘closed’ is describing something subtly different in each case - picking and choosing the ‘important’ relationship for each type, while protocols already have a subtyping relationship, and it sounds like there's possibility for enum subtyping in the future.<br class=""><br class="">I'd rather keep ‘open’ (and a potential future ‘closed’) purely describing the subtyping relationship, and have some other means of labelling conformance and cases as switchable.<br class=""></blockquote><br 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=""><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="">I am drafting a manifesto-style document regarding value subtyping which will make it clear how value subtypes fit into the picture. &nbsp;This document covers the relationship of enum cases with value subtyping and will show clearly how enum cases are analogous to subclasses.</span></div></blockquote><br class=""></div><div>I'm not sure how it fits your document, but I suspect value subtyping is pretty much not at all a source-compatibility or binary-compatibility concern. I think the only reasonable implementation here would be to perform conversions (unidirectional or bidirectional?), </div></div></blockquote><div><br></div><div>I meant to reply to this in my last message. &nbsp;Yes, the only sensible implementation I can think of is via conversion, which may be possible to optimize away in some cases where the supertype is representationally compatible with the subtype. &nbsp;Bidirectional conversion / inout wouldn't make sense. &nbsp;If you allow the supertype to mutate you may end up with a value that is not representable by the subtype.</div><br><blockquote type="cite"><div><div>which means that the subtyping is almost entirely a client-side feature and the only potential dynamic operation would be using 'as?' with a generic type. This is very different from protocols and classes, which perform dynamic dispatch to method implementations present on their subtypes.</div><div><br class=""></div><div>That is, the only effect of making a type "non-open" with respect to value subtyping would be to cut down on potential costs of 'as?'.</div><div><br class=""></div><div>Jordan</div></div></blockquote></body></html>