After discussing the proposal, the core team has decided to return SE-0295 for revision.
We agree that having a default Coding
synthesis for enum
s with payloads is valuable. Although the encoding may not be perfect for every use case, the default encoding is still valuable as it simplifies the cases where the encoding is sufficient. For the other use cases, the user is still able define the synthesis as they could previously.
Furthermore, the extensibility of Codable
is beyond the scope of this proposal as is the "readability" of the serialization itself. The design choices of Codable
are not grounds for preventing improvements to serialization in Swift.
The review additionally brought up points of repeated keys e.g.:
enum E {
case c(key: Int, key: Int)
}
This functionality is not intentional, and the compiler no longer accepts this construct and as a result, the proposal does not need to support this.
The core team would like to see the proposal consider additional enum types, including overloaded cases. The proposal is returned for revisions, with the intended focus being purely the extension of cases that can be handled for the default synthesis.
Thank you to everyone who participated in the review and helped improve the proposal.
Saleem Abdulrasool
Review Manager