fwcd / fwcd/swift-binary-coder

Investigate how to fix untagged enum serialization

Offen
#3 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
help wanted
Vorherrschende Sprache
Swift
Sterne
4
Forks
1
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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)?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.