# \[Question\] Why StringProtocol not inherit RangeReplaceableCollection?

**URL:** <https://forums.swift.org/t/question-why-stringprotocol-not-inherit-rangereplaceablecollection/7218>\
**Category:** Compiler\
**Created:** [December 6, 2017, 11:15am UTC](https://forums.swift.org/t/question-why-stringprotocol-not-inherit-rangereplaceablecollection/7218 "2017-12-06T11:15:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![frogcjn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/frogcjn/32/1486_2.png) [@frogcjn](https://forums.swift.org/u/frogcjn)\
**Post date:** [December 6, 2017, 11:15am UTC](https://forums.swift.org/t/question-why-stringprotocol-not-inherit-rangereplaceablecollection/7218/1 "2017-12-06T11:15:08Z")

</div>

Hi everyone,

I have a question about StringProtocol.  
Since String and Substring are adopted RangeReplaceableCollection, why StringProtocol not inherit RangeReplaceableCollection?

Also consider StringProtocol could inherit:  
CustomDebugStringConvertible  
CustomPlaygroundQuickLookable  
CustomReflectable  
CustomStringConvertible  
CVarArg  
Thanks!

---

<div class="post-metadata">

**Author:** ![Brent\_Royal-Gordon](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@Brent\_Royal-Gordon](https://forums.swift.org/u/Brent_Royal-Gordon)\
**Post date:** [December 11, 2017, 8:06am UTC](https://forums.swift.org/t/question-why-stringprotocol-not-inherit-rangereplaceablecollection/7218/2 "2017-12-11T08:06:37Z")

</div>

> Hi everyone,
> 
> I have a question about StringProtocol.  
> Since String and Substring are adopted RangeReplaceableCollection, why StringProtocol not inherit RangeReplaceableCollection?

With the goal of teaching a man to fish: `StringProtocol` was introduced after Swift 2.0, which means it was reviewed as part of the open evolution process and there is a proposal describing it. For `StringProtocol`, that proposal is SE-0163: \<[https://github.com/apple/swift-evolution/blob/master/proposals/0163-string-revision-1.md&gt](https://github.com/apple/swift-evolution/blob/master/proposals/0163-string-revision-1.md&gt);

Proposals describe not only what we are changing, but why we're doing it and why it has the chosen design. They should be your first stop when you're trying to understand why a part of Swift has a particular design. In this case, your question is answered a few paragraphs into the "proposed solution" section.

> Also consider StringProtocol could inherit:  
> CustomDebugStringConvertible  
> CustomPlaygroundQuickLookable  
> CustomReflectable  
> CustomStringConvertible  
> CVarArg

These are \*not\* discussed in that proposal, but the reasons are basically:

\* The `Custom*` protocols should only ever be adopted by types which specifically need to customize those things. They correspond to features which work with any type, so you shouldn't need to know whether a given type conforms to the `Custom*` protocol.

\* `CVarArg` indicates that a type can be passed with a C-compatible calling convention. While `String` and `Substring` can, there is no guarantee any other type which might conform to `StringProtocol` in the future would too.

> **···**
>
> > On Dec 6, 2017, at 3:15 AM, Cao, Jiannan via swift-dev \<swift-dev@swift.org\> wrote:
> 
> --  
> Brent Royal-Gordon  
> Architechies
