<html><head></head><body>Yes, I understand this. I was just wondering if there was a naming convention I should use to differentiate them.<div><br></div><div>Should I use a few letters as a prefix? Should I use the full protocol name as a prefix? Or is there another suggestion for a naming convention?</div><div><br></div><div>I&#39;m also curious about any naming conventions I should use to get around collisions with other libraries&#39; protocol associatedtypes.</div><div> <br> <p class="gmail_quote" style="color:#000">On May 31, 2017 at 16:26:52, Slava Pestov (<a href="mailto:spestov@apple.com">spestov@apple.com</a>) wrote:</p> <blockquote type="cite" class="gmail_quote"><span><div style="word-wrap:break-word" class=""><div></div><div>



<title></title>


<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On May 31, 2017, at 4:16 PM, Steven Brunwasser
&lt;<a href="mailto:sbrunwasser@gmail.com" class="">sbrunwasser@gmail.com</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px" class="">Basically, my library contains a bunch of collection-like
protocols, which can be combined in different ways and can be
compatible with each other in certain combinations when the proper
types align. Naturally, they all have an Element associatedtype,
but I need to allow for the possibility where two of these
collection protocols are implemented in the same structure that
requires different type definitions for each protocols&#39;
Element.</div>
</div>
</blockquote>
<div><br class=""></div>
Oh, I understand now. This is intentionally not supported —
associated types with the same name from different protocols must
all be implemented by the same typealias in the conforming
type.</div>
<div><br class=""></div>
<div>Slava</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">
<div style="font-family:Helvetica,Arial;font-size:13px;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" class="">
<div class=""><br class=""></div>
<div class="">I’ve been trying to make some other protocols to
simplify some definitions, but specifying a parent protocol’s
associated type within a child protocol doesn’t seem to work.</div>
<div class=""><br class=""></div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>protocol Buzz: Bar {</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>typealias Container = A</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>}</div>
<div class=""><br class=""></div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"></span>struct BuzzImpl: Buzz {}
// <b class=""><font face="Menlo" class=""><span style="font-size:11px" class="">error: type ‘BuzzImpl&#39; does not
conform to protocol ‘Buzz&#39;</span></font></b></div>
<br class="">
<p class="airmail_on">On May 31, 2017 at 4:02:43 PM, Slava Pestov
(<a href="mailto:spestov@apple.com" class="">spestov@apple.com</a>)
wrote:</p>
<blockquote type="cite" class="clean_bq"><span class=""></span>
<div class="" style="word-wrap:break-word"><span class=""></span>
<div class=""><span class=""></span></div>
<div class=""><span class="">Can you give an example of a
problematic name collision? Does fully qualifying names not
help?</span>
<div class=""><span class=""><br class=""></span></div>
<div class=""><span class="">Slava</span></div>
<div class=""><span class=""><br class=""></span>
<div class=""><span class=""></span>
<blockquote type="cite" class=""><span class=""></span>
<div class=""><span class="">On May 31, 2017, at 4:01 PM, Steven
Brunwasser via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</span></div>
<span class=""><br class="Apple-interchange-newline"></span>
<div class=""><span class=""></span>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">Hi,</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class=""><br class=""></span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">I have a library which uses a few generic protocols
with identically named associated types that may not always be
specified identically by implementors.</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class=""><br class=""></span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">protocol Foo {</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">associatedtype Container</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">associatedtype Element</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">}</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class=""><br class=""></span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">protocol Bar {</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">associatedtype Container</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">associatedtype Element</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">}</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class=""><br class=""></span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">struct Baz: Foo, Bar {</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">// Implement using two different Container/Element
types.</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">}</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class=""><br class=""></span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">Is there a consensus on some naming convention for
associatedtypes to mitigate name collisions?</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">Would it be acceptable to add namespace prefixes to
these types?</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class=""><br class=""></span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">protocol Foo {</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">associatedtype FooContainer</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">associatedtype FooElement</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">}</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class=""><br class=""></span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">I’m using the dictionary and thesaurus to find some
alternative names I could use, but the ones already used are so the
most sensical semantically.</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class=""><br class=""></span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">Do you have any suggestions?</span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class=""><br class=""></span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">Thanks, </span></div>
<div id="bloop_customfont" class="" style="font-family:Helvetica,Arial;font-size:13px;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;margin:0px">
<span class="">- Steve Brunwasser</span></div>
<span class=""><span class="" style="font-family:Helvetica,Arial;font-size:13px;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;float:none;display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica,Arial;font-size:13px;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">

<span class="" style="font-family:Helvetica,Arial;font-size:13px;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;float:none;display:inline!important">
swift-users mailing list</span><br class="" style="font-family:Helvetica,Arial;font-size:13px;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">

<a href="mailto:swift-users@swift.org" class="" style="font-family:Helvetica,Arial;font-size:13px;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">
swift-users@swift.org</a><br class="" style="font-family:Helvetica,Arial;font-size:13px;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">

<a href="https://lists.swift.org/mailman/listinfo/swift-users" class="" style="font-family:Helvetica,Arial;font-size:13px;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">
https://lists.swift.org/mailman/listinfo/swift-users</a></span></div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br class="">


</div></div></span></blockquote>

</div></body></html>