Skip to content

Reduce code duplication #1

@greg

Description

@greg
  • SuperEncoder's conformance to SingleValueEncodingContainer looks a lot like _Encoder's (and similarly for the decoders); it would improve readability if a new type SingleValueContainerWrapper were created to replace both of these, and complement the keyed and unkeyed container wrappers.

  • Implementations of container(keyedBy:), unkeyedContainer(), and singleValueContainer(), the nested versions of those, and superEncoder() have a lot of checks in common; the code would be a lot clearer if those were combined. The same applies to the decoder.

Hopefully this reduction in boilerplate will help to make the encoder & decoder implementations slightly more readable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorRefactoring/improving existing code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions