<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div>On Jun 9, 2017, at 16:38, Daryle Walker via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</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 Jun 9, 2017, at 12:14 AM, Yvo van Beek 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=""><div dir="ltr" class="">Typealiases can greatly reduce the complexity of code. But I think one change in how the compiler handles them could make them even more powerful.</div></div></blockquote>[SNIP]<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Perhaps it would be better if the extension would only apply to the parts of my code where I use the HeaderKey typealias and not to all Strings. This could be a great tool to specialize classes by creating a typealias and adding functionality to it. Another example I can think of is typealiases for dictionaries or arrays with added business logic through extensions (especially since you can't inherit from structs).<font color="#0b5394" face="monospace, monospace" class=""><br class=""></font></div><div class=""><br class=""></div><div class="">If you want to create an extension that adds functionality to all Strings you could have created an extension for String instead of HeaderKey.</div><div class=""><br class=""></div><div class="">Please let me know what you think. I'm not sure how complex this change would be.</div><div class="">I could write a proposal if you're interested.</div></div></div></blockquote><br class=""></div><div>Isn’t the point of “typealias" is that it does NOT have any change in semantics? The compiler doesn’t even have to acknowledge aliases in any run-time type tables, it just references the existing row of what the alias points to (based on a compile-time type table).</div><br class=""><div class="">As others suggested, this new semantic could be moved to a new type concept (with a new keyword).</div></div></blockquote><br><div>Agreed... +1 for something like "newtype", -1 for hoisting that functionality onto "typealias".</div><div><br></div><div>- Dave Sweeris</div></body></html>