[swift-evolution] Swift's Optional Int as NSNumber in Objective-C

T.J. Usiyan griotspeak at gmail.com
Mon May 15 06:09:16 CDT 2017


My understanding of the reasoning is that `NSNumber` is an object in
Objective-C and not a struct. There is already one level of decision when
translating to objc in that regard. Switching between reference
semantics/class and value semantics because of optionality is surprising.

On Mon, May 15, 2017 at 5:52 AM, Kenny Leung via swift-evolution <
swift-evolution at swift.org> wrote:

> > On May 12, 2017, at 9:56 AM, John McCall via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> > Exporting Int? as an optional NSNumber does not feel obvious and
> idiomatic when we would export Int as NSInteger.  It feels like reaching
> for an arbitrary solution.
>
> I don’t understand this reasoning. I’ve had cause to distinguish 0 from
> null in both Objective-C and Java, and I would do exactly the same thing.
>
> -Kenny
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170515/c65d2f72/attachment.html>


More information about the swift-evolution mailing list