Protocol as Type question

To quote @itaiferber from an older thread on this topic:

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.

2 Likes