[swift-evolution] [swift-evolution-announce] [Review] SE-0016 - Adding initializers to Int and UInt to convert from UnsafePointer and UnsafeMutablePointer

Andrew Trick atrick at apple.com
Thu Mar 24 23:38:37 CDT 2016


> On Mar 22, 2016, at 2:35 PM, Chris Lattner <clattner at apple.com> wrote:
> 
> The review of "Adding initializers to Int and UInt to convert from UnsafePointer and UnsafeMutablePointer" begins now and runs through March 25th. The proposal is available here:
> 
> 	https://github.com/apple/swift-evolution/blob/master/proposals/0016-initializers-for-converting-unsafe-pointers-to-ints.md <https://github.com/apple/swift-evolution/blob/master/proposals/0016-initializers-for-converting-unsafe-pointers-to-ints.md>

+1

I agree with all of the feedback so far, and I think bitPattern is a good label name.

The dangerous case is the UInt to UnsafePointer conversion that already exists. If we allow that, then adding symmetry is only natural.

I’ll add that I don’t particularly like the practice of using unsafeBitcast on pointer values. It does not sufficiently inform the compiler that the type system is being circumvented because no information is carried through to the point of access. UInt to UnsafePointer has the same problem, but I like the fact that a separate, explicit API is used when pointers are involved.

-Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160324/ac058bd5/attachment.html>


More information about the swift-evolution mailing list