<div dir="ltr">For protocols named XXXble I think they should have a main method named XXX. If this were adopted then many protocol names would change, e.g.:<div><br></div><div>    1. ForwardIndexType would be Advanceable because it has advance methods and method successor() would be renamed advance().</div><div>    2. Indexable would be Subscriptable because it has a subscript method.</div><div>    3. Etc.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 29 January 2016 at 05:03, Erica Sadun via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Jan 27, 2016, at 11:42 PM, Dave Abrahams via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div><br>on Wed Jan 27 2016, Dave &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br><blockquote type="cite">Huh… Yeah, you’re right. I guess I saw “CollectionType” and<br>“CustomStringConvertible” or something and made a connection that<br>wasn’t there.<br>Well, FWIW, that convention (plus the occasional “HasNoun”, and<br>-ableType for constraining the element of custom collections) tends to<br>work well for me.<br><br>What’s been the deciding factor between -Type and -able so far?<br></blockquote><br>When there&#39;s no reasonable -able or -ible name, use -Type.<br></div></div></blockquote></div><br><div>This is where I never know whether to keep my nose out of things or just jump in. I find there are generally two kinds of protocols: verby-ones (&quot;this is how this thing works&quot;) and nouny-ones (&quot;this is what this thing is&quot;). Here&#39;s the guidance I&#39;ve been giving:</div><div><br></div><div><i>Swift protocols describe the surface that connect a feature provider API with its consumer. Protocols establish a communication contract. They ensure a fit between each required member and the provider’s implementation. It’s like whether a virus can attach to a host cell’s receptors, or whatever the actual biological equivalent is. </i><i>The standard library describes protocols using nouns (typically ending in Type, e.g. MirrorPathType, MutableCollectionType, ErrorType) and adjectives (typically ending in ble, like Streamable, Strideable, ArrayLiteralConvertible). The former more commonly discuss what a conforming type is and the latter what it does.  </i></div><div><div><i><br></i></div><div><i>When naming a protocol, you’re not limited to Type and ble endings. Your protocol can be, for example, a DataProvider or a FloatConsumer. A protocol can describe a relationship DownloadProcessingDelegate or ListViewDataSource. You may implement an OutputDestination or an IntegerSink. The current API Design guidelines say &quot;omit needless words&quot;, so you might prefer to go with DataProvider over DataProviderType or  MirrorPath over MirrorPathType, but I wouldn&#39;t give much more constraint to naming beyond that.</i></div></div><div><br></div><div>For example, for &quot;HasNoun&quot;, I&#39;d go with something more like NounContainingType or NounSupplier.</div><div><br></div><div>Non-Abrahams Dave writes: &quot;I like -Type for protocols that can only be used a generic constraint, and -able/-ible for protocols that can be “concrete” types.</div><div><br></div><div>And Canonical Dave replies: &quot;But that&#39;s not how they&#39;re used.  I&#39;d have to rename Equatable and Comparable to follow that convention.&quot;</div><div><br></div><div>I agree in that I&#39;m not convinced it&#39;s the role of a protocol to describe implementation details. (I&#39;d say the same for method names, but that&#39;s different thread about mutability and side effects, etc). Going that way leads you to over-designated hungarian-esque guidelines that I&#39;d rather keep loose, friendly, and sensible.</div><div><br></div><div>-- Erica</div><div><br></div><div><br></div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">  -- Howard.<br></div>
</div>