fwcd / fwcd/swift-binary-coder

Investigate how to fix untagged enum serialization

Aperta
#3 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
help wanted
Lingua principale
Swift
Stelle
4
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Since the synthesized `Encodable` implementation for enums is externally tagged by key and we discard keys during encoding, enums currently use a completely untagged representation, which can make it hard to distinguish cases during decoding.

As described [in the test case](https://github.com/fwcd/swift-binary-coder/blob/5270e91c53e2b75a32c8383de74743233d8aab7a/Tests/BinaryCoderTests/BinaryEncoderTests.swift#L36-L39), we should investigate whether non-`.untaggedAndAmbiguous` strategies should throw an error, even though there may be a runtime cost to detect whether a type is an enum (e.g. through reflection)?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.