[swift-evolution] [Pitch] Add Null struct to Foundation

Alsey Miller colemancda at me.com
Thu Jun 23 00:57:42 CDT 2016

Please see

https://github.com/PureSwift/SwiftFoundation/blob/develop/Sources/SwiftFoundation/Null.swift <https://github.com/PureSwift/SwiftFoundation/blob/develop/Sources/SwiftFoundation/Null.swift>

https://github.com/PureSwift/SwiftFoundation/blob/develop/Sources/SwiftFoundation/JSON.swift <https://github.com/PureSwift/SwiftFoundation/blob/develop/Sources/SwiftFoundation/JSON.swift>

Specifically, line 77 in JSON.swift


> On Jun 23, 2016, at 12:54 AM, David Waite <david at alkaline-solutions.com> wrote:
>> On Jun 22, 2016, at 10:14 PM, Alsey Miller via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> Add a struct Null to the Swift 3.0 Foundation value types. As a struct, Null is more performant (no ARC or memory allocation) than NSNull, and will be needed for Swift JSON decoders and libraries that want to use struct value types, and be free from classes for their model layer.
> I assume you are thinking of [String:SomeRootJSONProtocol] as the Object type? However, once you reference the data as a protocol however, it will be promoted and stored as a reference type.
> I’ve preferred a similar approach to the following for JSON (although this isn’t my code): https://gist.github.com/dorentus/1e2132edfb174028bf11#file-json-swift-L30-L38 <https://gist.github.com/dorentus/1e2132edfb174028bf11#file-json-swift-L30-L38>
> -DW

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160623/423ebaae/attachment.html>

More information about the swift-evolution mailing list