BinaryCodable icon indicating copy to clipboard operation
BinaryCodable copied to clipboard

Explore mechanisms for defining external binary representations

Open jverkoey opened this issue 6 years ago • 0 comments

Swift Codable is able to generate encoding and decoding implementations for free because of the availability of key/value containers. Binary Codable does not support key/value containers, so it is not presently possible to map properties to external representations without making some potentially scary assumptions about order.

A completely generalized solution to this problem is not desired due to the need for conditional encoding/decoding paths in complex cases. Solving conditional coding is considered a non-goal for this task; in such cases custom implementations of encoding/decoding are encouraged instead.

A successful solution to this task will meet the following requirements:

  • [ ] It is possible to map properties to regions of memory bi-directionally (encoding + decoding).
  • [ ] It is possible to map BinaryCodable entities to regions of memory bi-directionally (encoding + decoding).
  • [ ] Such a definition only needs to be made once for a given object, similar to the CodingKeys pattern in Swift Codable.

jverkoey avatar Feb 19 '19 00:02 jverkoey