[swift-evolution] [Proposal] Foundation Swift Archival & Serialization
anthony.parker at apple.com
Thu Mar 16 15:59:23 CDT 2017
> On Mar 16, 2017, at 1:50 PM, Slava Pestov via swift-evolution <swift-evolution at swift.org> wrote:
> Hi Itai,
> I’m wondering what the motivation is for keeping this as part of Foundation and not the standard library. It seems like you’re landing an implementation of this in the Foundation overlay on master, and another copy of all the code will have to go into swift-corelibs-foundation. This seems suboptimal. Or are there future plans to unify the Foundation overlay with corelibs-foundation somehow?
I would like some unification in the future, but they are currently two separate implementations for a bunch of reasons (lack of bridging on Linux being a huge one, along with the inability of the standard library and runtime to distinguish between presence of Objective-C and the presence of Foundation).
> Also the implementation uses some Foundation-isms (NSMutableArray, NSNumber) and it would be nice to stick with idiomatic Swift as much as possible instead.
The implementation you’re looking at is for JSONArchiver, which is based on NSJSONSerialization, which is part of Foundation and not the standard library. That’s a primary reason to use Foundation. NSJSONSerialization also deals with types like ‘Date’ which are in Foundation. Finally, the primitive Coding API uses Data, which is a Foundation type.
So in summary, I’m fine with this API being part of Foundation. Foundation is available the same places the standard library is, so it is more than acceptable to use Foundation API and types here.
> Finally you should take a look at the integer protocol work (https://github.com/apple/swift-evolution/blob/master/proposals/0104-improved-integers.md <https://github.com/apple/swift-evolution/blob/master/proposals/0104-improved-integers.md>) to replace the repetitive code surrounding primitive types, however I don’t know if this has landed in master yet.
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution