[swift-evolution] [Review] SE-0166: Swift Archival & Serialization
jon at jonshier.com
Thu Apr 13 09:49:48 CDT 2017
> And all of this is only an issue if you write the conformance by hand in the first place. Usually, you won't.
Brent, given that this API is designed not just for NSKeyedArchiver-like usage, but to form the basis of serialization to and from JSON, among other network types, I really don’t think this is true. It just won’t work by default for JSON, if only because JSON has informally standardized on snake-case keys (some_key). AFAICT, this proposal has nothing to enable developers to define a key convention that automatically generates such keys. So, from my perspective, every single use of the proposed APIs that isn’t just a replacement for NSKeyedArchiver will be forced to manually implement the entire API, unless developers get lucky and somehow get a representation that fits a good Swift type exactly. That just doesn’t happen. There are so many bad JSON APIs out there that being able to easily define different keys and transforms of a JSON type to some Swift type isn’t just a convenience, it’s a requirement.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution