KeyedDecodingContainerProtocol decode methods non-mutating?

Can anybody tell why the decode methods in UnkeyedDecodingContainer
are marked mutating but those in KeyedDecodingContainerProtocol and
SingleValueDecodingContainer are not? Is it a simple oversight or is
there a reason for this? It seems to me that all of them should be
mutating.

Thanks,
Ingo

The `UnkeyedDecodingContainer.decode(_:)` methods consume values as they decode them; that is, the first call returns the first value, the second call returns the second value, etc. The ones in the other containers don't consume values; in theory, you could decode the same key twice and you should get the same value both times. So the UnkeyedDecodingContainer methods are mutating, but the other containers' methods are not.

ยทยทยท

On Dec 28, 2017, at 1:57 PM, Ingo Maier via swift-users <swift-users@swift.org> wrote:

Can anybody tell why the decode methods in UnkeyedDecodingContainer
are marked mutating but those in KeyedDecodingContainerProtocol and
SingleValueDecodingContainer are not? Is it a simple oversight or is
there a reason for this? It seems to me that all of them should be
mutating.

--
Brent Royal-Gordon
Architechies