# Enum cases as protocol witnesses

**URL:** <https://forums.swift.org/t/enum-cases-as-protocol-witnesses/32753>\
**Category:** Pitches\
**Tags:** protocols\
**Created:** [January 18, 2020, 7:23pm UTC](https://forums.swift.org/t/enum-cases-as-protocol-witnesses/32753 "2020-01-18T19:23:40Z")\
**Posts on this page:** 1\
**Showing post:** 188

<div class="post-metadata">

**Author:** ![xwu](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@xwu](https://forums.swift.org/u/xwu)\
**Post date:** [January 25, 2020, 5:56pm UTC](https://forums.swift.org/t/enum-cases-as-protocol-witnesses/32753/188 "2020-01-25T17:56:43Z")

</div>

> [@Jumhyn](#):
>
> Similarly, the compiler _can’t_ enforce that enums only witness these “factory” `static func` requirements—it can only add syntactic hoops that someone has to jump through in order to witness the non-factory requirements (either with underscored cases or some alternative method to this proposal). We could introduce annotations like `@constantTime` to force protocol conformers to syntactically document their time complexity (even if conformers went on to violate that contract), but it’s been deemed sufficient so far to allow protocols to declare most of their semantics as documentation. I’m not convinced that this issue rises to the level of importance (as opposed to say, `mutating` vs. non `mutating` ) to require syntactic barriers to conformance.

For the utility of annotating factory semantics, see prior discussions such as the following: [[Proposal] Factory Initializers](https://forums.swift.org/t/proposal-factory-initializers/609).

---

_[View the full topic](https://forums.swift.org/t/enum-cases-as-protocol-witnesses/32753)._
