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

fukurokujo fukurokujoe at googlemail.com
Mon Mar 28 06:47:06 CDT 2016


> * What is your evaluation of the proposal?

-1

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

No `UnsafePointer` and `UnsafeMutablePointer` already provide their address  as Int by their `hashValue` property (maybe add a dedicated `address` property that returns this???), this means it is already possible to do XOR on the addresses of two pointers. 

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

No, UnsafePointer and UnsafeMutablePointer etc. should be only used in rare cases e.g. interaction with C APIs or similar.
But maybe there should be a dedicated `address` property as `hashValue` seems to be a bit non obvious.

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

Everything in the proposal is already possible and if one creates a XOR operator for unsafe pointers via their `hashValue` it
does not differ too much from doing the same thing in a language like C.

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

Implemented functions that make use of XORing unsafe pointers in Swift.


More information about the swift-evolution mailing list