# Protocol as Type question

**URL:** <https://forums.swift.org/t/protocol-as-type-question/18782>\
**Category:** Using Swift\
**Tags:** codable\
**Created:** [December 13, 2018, 11:37am UTC](https://forums.swift.org/t/protocol-as-type-question/18782 "2018-12-13T11:37:35Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![zoul](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/zoul/32/9559_2.png) [@zoul](https://forums.swift.org/u/zoul)\
**Post date:** [December 13, 2018, 5:08pm UTC](https://forums.swift.org/t/protocol-as-type-question/18782/14 "2018-12-13T17:08:21Z")

</div>

To quote @itaiferber from [an older thread on this topic](https://forums.swift.org/t/how-to-encode-objects-of-unknown-type/12253):

> This was a conscious design decision we made to help prevent folks from encoding type-erased values which they would not be able to decode, without at least thinking about it.
> 
> From long-standing experience in this area — we wanted to help prevent more cases of “well, my app only ever needs to encode values, so my encoding scheme is fine” from becoming “design requirements have changed and now we need to decode the data, but because we never had the types, we can’t decode any of it”. Archived data is forever, and unless you’re aware of the tradeoffs you might be making by encoding type-erased values, you can write yourself into a hole.

---

_[View the full topic](https://forums.swift.org/t/protocol-as-type-question/18782)._
