[swift-evolution] Proposal: [stdlib] Remove withUnsafe[Mutable]Pointer[s]()
jgroff at apple.com
Wed Dec 16 15:53:19 CST 2015
> On Dec 16, 2015, at 1:51 PM, Kevin Ballard <kevin at sb.org> wrote:
> On Wed, Dec 16, 2015, at 01:38 PM, Joe Groff wrote:
>> The pointer conversions are already poorly discoverable, and people don't know they exist since code completion doesn't make it apparent. Showing the APIs as overloaded taking 'inout's or something similar would make it more apparent how you can use them.
> I'm hoping that adding documentation to UnsafePointer/UnsafeMutablePointer that mentions the conversions will help a lot, and ideally the book would mention this too (presumably as a note in the section on in-out parameters). If I didn't already know about the conversion and I encountered a function expecting an UnsafePointer/UnsafeMutablePointer, my first inclination is to type "UnsafePointer" (or "UnsafeMutablePointer") into the documentation browser and read the results. This is why I don't like withUnsafe[Mutable]Pointer[s]() existing, because it makes people think that's what you have to use, when in most cases the &x conversion is simpler.
They are documented fairly extensively in "Using Swift with Cocoa and Objective-C" (since they exist to interop with C):
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution