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

Guillaume Lessard glessard at tffenterprises.com
Thu Mar 24 11:48:27 CDT 2016

> * What is your evaluation of the proposal?

I support this. Currently this requires the use of unsafeBitCast, which works okay but is unwieldy.
I used unsafeBitCast to implement tagged pointers in a previous exploratory project, and I think this proposal would improve readability without being an inducement to recklessness.

“bitPattern” is a decent label, but that is also used for the lossy int-to-int conversions; pointer-to-int casting may be different enough to warrant a different label. “unsafeAddress” comes to mind, but may clash with the similarly-named function.

> * Is the problem being addressed significant enough to warrant a change to Swift?


> * Does this proposal fit well with the feel and direction of Swift?


> * If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

Like uintptr_t, this requires an intentional step in order to do bit operations on pointers.

> * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A careful read and some experience trying this in swift.

Guillaume Lessard

More information about the swift-evolution mailing list