<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">+1 for `type`, it is consistent with `func`, `var` and `init`. It looks good to me.<div class=""><br class=""></div><div class="">eg:</div><div class=""><br class=""><div class="">protocol Stream {</div><div class="">&nbsp; &nbsp; type Payload</div><div class="">&nbsp; &nbsp; var ready: Bool { get }</div><div class="">&nbsp; &nbsp; func read() -&gt; Payload?</div><div class="">}</div><div class=""><br class=""></div><div class="">protocol Collection {</div><div class="">&nbsp; &nbsp; type Element</div><div class="">&nbsp; &nbsp; var count: Int { get }</div><div class="">&nbsp; &nbsp; func contains(element: Element) -&gt; Bool</div><div class="">}</div><div class=""><br class=""></div><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">--&nbsp;</div><div class="">Pierre</div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">Le 19 déc. 2015 à 18:46, Loïc Lecrenier via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi,<br class=""><br class="">I’m starting a new thread for this proposal <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0011-replace-typealias-associated.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0011-replace-typealias-associated.md</a><br class=""><br class="">So far, everybody agreed that using distinct keywords for type alias and associated type declarations is a good idea.<br class="">However, some people think that “associated” is not an ideal replacement because it is too vague.<br class="">I would like to choose a better keyword before the review, but I’m struggling to find a good replacement. <br class=""><br class="">So, here are some keywords that were proposed by the community.<br class=""><br class="">1. associated_type<br class="">This is the original proposed keyword. It is extremely clear, but snake_cases are un-Swifty.<br class=""><br class="">2. associatedtype (or typeassociation)<br class="">This was the first alternative to associated_type. Its purpose is still extremely clear.<br class="">I like it a lot, but it is a bit long and difficult to read.<br class=""><br class="">3. associated<br class="">This is the keyword I chose for the proposal because it was the most well-received initially. <br class="">It is quite short, very different from “typealias", and sounds good. However, it is also vaguer.<br class="">Because the word “type” is not in it, it’s unclear what should follow it, and it’s unclear what it declares.<br class="">For example, one could think that it is an associated *value* and write <br class="">protocol FixedSizeCollectionProtocol {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>associated size : Int<br class="">}<br class="">Although honestly I doubt many people would write that. <br class=""><br class="">4. withtype (or needstype)<br class="">It is short, somewhat easy to read, has the word “type” in it, and some concept of association thanks to “with”. I like it. <br class="">But it doesn’t sound very good, and is still vaguer than “associatedtype”.<br class=""><br class="">5. type<br class="">This keyword was proposed by several people, but I strongly dislike it.<br class="">It conflicts with an other proposal about unifying the “static” and “class” keywords for type-level members.<br class="">I think the fact that it was proposed for two completely different purposes shows that it is too abstract.<br class="">It would make searching for help more difficult because of its bad googleability.<br class=""><br class=""><br class="">Personally, I would like to either keep “associated”, or use “associatedtype” because they are the most obvious choices.<br class=""><br class="">1) Do you agree about using “associatedtype”?<br class="">2) If not, which keyword would you prefer to use? why? (you can introduce a new one)<br class="">Bonus) Maybe some twitter-famous person could make a quick poll and see which one developers prefer? 😁 (after they read this email)<br class="">I would gladly do it myself, but I don’t think my twenty (mostly fake) followers will give me a lot of information. &nbsp;<br class=""><br class="">Loïc<br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></div></div></body></html>