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

David Waite david at alkaline-solutions.com
Thu Jun 23 00:54:19 CDT 2016


> On Jun 22, 2016, at 10:14 PM, Alsey Miller via swift-evolution <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

-DW
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160622/8d0c7951/attachment.html>


More information about the swift-evolution mailing list