Hey, Philippe, everyone. I've been working on implementing SE-0055: Making 
pointer nullability explicit 
<https://github.com/apple/swift-evolution/blob/master/proposals/0055-optional-unsafe-pointers.md>,
 and it's been going well…but only now am I realizing how much it's going to 
affect Foundation, and possibly CF as well. While the nullability of APIs can 
usually be brought over from the Foundation headers, there are a lot of places 
where SwiftFoundation isn't clear about its nullability requirements within its 
implementation. For example, NSData appears to allow replacing a range of bytes 
with a {NULL, 0} buffer, but the implementation currently calls directly 
through to _CFDataReplaceBytes, which does not accept null pointers. (And if it 
were annotated to, it would then try to memmove from it, which is illegal.) The 
fix is trivial—just check for the null pointer case (or zero length case) and 
use an alternate API instead—but there might be quite a few of them.

I'm planning to run through all of Foundation (and XCTest) and get their tests 
passing using my branch of Swift <https://github.com/apple/swift/pull/1878>, 
then submit a pull request for review, to be landed in sync with the Swift 
change. Does that sound like the best plan to you?

Thanks,
Jordan
_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

Reply via email to