[swift-evolution] [Pitch] Making some RawRepresentable things bridge to ObjC as their raw value

Dave Abrahams dabrahams at apple.com
Sat Oct 1 10:45:01 CDT 2016


on Fri Sep 30 2016, Russ Bishop <swift-evolution at swift.org> wrote:

>> On Sep 29, 2016, at 11:45 AM, Douglas Gregor via swift-evolution
>> <swift-evolution at swift.org> wrote:
>>> 
>> 
>> 
>
>> Personally, I consider the first one to be a fairly-low-risk
>> extension to SE-0139 that’s borderline bug-fix. We already know that
>> those types have weak numeric representations in Objective-C because
>> they come from Objective-C, so losing some of the type info by
>> bridging to Objective-C is (IMO) falls out of having strong types in
>> Swift for weaker types in Objective-C.
>> 
>> The second one makes me a little nervous, I think because it weakens
>> typing for types defined in Swift. These types don’t naturally have
>> Objective-C counterparts, so if we’re going to weaken the types, it
>> feels like we should only do so via some explicit conformance (e.g.,
>> to a publicly-available form of _ObjectiveCBridgeable).
>> 
>> 	- Doug
>> 
>
> I’m up for reviving the ObjectiveCBridgeable proposal :)

Okay, but IMO the API of that protocol is wrong.  Any public interface
should look something like _CustomObjectiveCBridgeable per
https://github.com/apple/swift/commit/87944ed2449ec7314ed8690b8894ce96ad339ebf#diff-9b6ea5442068d139aa4193a59b6e4b91

-- 
-Dave



More information about the swift-evolution mailing list