# \[Pitch\] Primary Associated Types in the Standard Library

**URL:** <https://forums.swift.org/t/pitch-primary-associated-types-in-the-standard-library/56426>\
**Category:** Pitches\
**Tags:** generics, protocols, stdlib\
**Created:** [April 1, 2022, 12:31am UTC](https://forums.swift.org/t/pitch-primary-associated-types-in-the-standard-library/56426 "2022-04-01T00:31:19Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![lorentey](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lorentey/32/1299_2.png) [@lorentey](https://forums.swift.org/u/lorentey)\
**Post date:** [April 2, 2022, 12:11am UTC](https://forums.swift.org/t/pitch-primary-associated-types-in-the-standard-library/56426/20 "2022-04-02T00:11:25Z")

</div>

> [@benrimmington](#):
>
> It might be worth grouping the table, into protocols which are
> 
> 1. **Candidates for this proposal:**
> 
> - they declare or inherit associated types.
> 
> 1. **Not applicable:**
> 
> - they currently don't have associated types;
> - marker protocols ( `Sendable` and `UnsafeSendable` );
> - type aliases ( `Unicode.Encoding` and `Unicode.Parser` ).

Good idea -- I updated the original post accordingly. I also listed the rest of the associated types for each protocol. (Check out the list on `StringProtocol`. 🤓🤨)

Note that `Unicode.Encoding` and `Unicode.Parser` are considered public protocols that currently happen to be typealiases to underscored protocol definitions, for very annoying technical reasons. (Which we should eventually get around to resolving...)

> [@benrimmington](#):
>
> Are `KeyedEncodingContainerProtocol` and `KeyedDecodingContainerProtocol` commonly used?

No -- in fact, given that `Encoder`/`Decoder` sadly forces these into type-erased boxes, there is very little reason for anyone to write generic functions over them. Therefore, there is no reason for these to have a primary associated type. 😞

I updated the table accordingly.

---

_[View the full topic](https://forums.swift.org/t/pitch-primary-associated-types-in-the-standard-library/56426)._
