<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 12, 2017 at 6:56 PM, John McCall via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I assume you're talking about the type restrictions on exporting Swift functions as @objc. We have the technical ability to bridge any Swift value to Objective-C as an opaque object, but that wouldn't actually produce meaningful APIs on the ObjC side; we have to have some sort of tighter policy than that. Today, that policy is to allow export when there's an obvious, idiomatic analogue in Objective-C. 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.</blockquote></div><br>Actually Swift already export Ints as NSNumbers in other contexts when types like Int are used in generic constraints, particularly value types like Array or Dictionary. For example, a variable of type [Int] gets bridged over as a NSArray<NSNumber *> *.</div><div class="gmail_extra"><br></div><div class="gmail_extra">For such purposes Swift already has types like _SwiftTypePreservingNSNumber , a subclass of NSNumber.</div><div class="gmail_extra"><br></div><div class="gmail_extra">If that can apply to Array<Int> or Dictionary<Int, Int>, the same reasoning can be applied to the Optional<Int>.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I mean, I'm not saying that there are no reasons to disallow it, but it doesn't seem an arbitrary solution if in other contexts Swift is already doing that.</div><div class="gmail_extra"><div><br></div>-- </div><div class="gmail_extra">Víctor Pimentel<div class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr" style="font-size:12.8px"><div style="font-size:12.8px"></div></div></div></div></div></div></div></div></div></div></div>
</div></div>