Does that mean that once structural types can conform to protocols, would the core team want to remove Optional as a nominal type and just use “T?”? Or has that ship sailed because of source compatibility and you just don’t want to introduce any new nominals that shadow structurals?<br><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 21, 2017 at 3:10 PM Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><br><div><br><blockquote type="cite"><div>On Nov 21, 2017, at 3:05 PM, Slava Pestov <<a href="mailto:spestov@apple.com" target="_blank">spestov@apple.com</a>> wrote:</div><br class="m_1506612575082669525Apple-interchange-newline"><div><div style="word-wrap:break-word;line-break:after-white-space"><br><div><br><blockquote type="cite"><div>On Nov 21, 2017, at 6:02 PM, David Hart <<a href="mailto:david@hartbit.com" target="_blank">david@hartbit.com</a>> wrote:</div><br class="m_1506612575082669525Apple-interchange-newline"><div><div 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">Can somebody explain to me what are </div><div 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"> nominal and structural types and why Optional should really be a structural type?</div></div></blockquote></div><br><div>Nominal types are structs, enums, protocols and classes. They have declarations in source and are uniquely identified by their name. Structural types are functions, meta types, protocol compositions, and tuples.</div><div><br></div><div>The distinction is not as clear as you might think because as Chris said, you can imagine tuple being implemented as ‘struct Tuple<T…>’, similarly functions and meta types could also be written as such. It is mostly a syntactic distinction in the language, but it has far-reaching consequences in internal representations, which is why for now it would be tricky to have structural types conform to protocols.</div></div></div></blockquote><br></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div>Right. Optionals are a tricky case because we wanted them to be nominal so we could write extensions on them and make them conform to protocols, but, they’re so integral to the language that they are really treated like a structural type.</div><div><br></div><div><span class="m_1506612575082669525Apple-tab-span" style="white-space:pre-wrap">        </span>- Doug</div><div><br></div><br></div>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>