[swift-evolution] [Pitch] SE-0083 revisited: removing bridging behavior from `as`/`is`/`as?` casts

Joe Groff jgroff at apple.com
Thu Mar 2 20:22:14 CST 2017


> On Mar 2, 2017, at 6:16 PM, Charles Srstka <cocoadev at charlessoft.com> wrote:
> 
>> On Mar 1, 2017, at 10:11 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> I’d like to investigate separating Objective-C bridging from the behavior of the as/as?/is operator family again for Swift 4. Last year, I proposed SE–0083, but we deferred the proposal for lack of time to evaluate its impact. As complicating factors, we now have source compatibility with Swift 3 as a requirement, and the id-as-Any work from SE–0116 more or less requires bridging dynamic casts to work. 
>> 
> That decision still seems strange to me. For a change that necessarily involves source breakage, let’s defer until after we’ve pledged source compatibility. Huh?
> 
> Nevertheless, I’d be willing to put up with some source breakage for this, myself. The weird bridging behavior on “as” and friends is a good candidate for the single most confusing thing about Swift as it stands today.

To be clear, we wouldn't do anything that would disrupt Swift 3 code. The compatibility plan for Swift is based on language dialects, so Swift 4 code would get the new behavior, but could still be compiled and linked with Swift 3 modules. (Likewise, Swift 3 code should be able to adopt Swift 4 dependencies without having to upgrade itself.)

-Joe


More information about the swift-evolution mailing list