On Tue, Mar 22, 2016 at 11:35 PM, Chris Lattner via swift-evolution <
swift-evolution@swift.org> wrote:
> Hello Swift community,
>
> The review of "Adding initializers to Int and UInt to convert from
> UnsafePointer and UnsafeMutablePointer" begins now and runs through March
> 25th. The proposal i
One of the alternatives discussed in the proposal was adding mathematical
operators to UnsafePointer so you can manipulate the pointers directly, such as
XORing them, checking alignment, etc. I would very much prefer that we add
operators and functions to UnsafePointer to express intent.
Conve
I'm not sure what you mean by "the operator approach". Do you mean measuring
the distance between a pointer and nil? That assumes that nil's representation
is 0 (which admittedly it is on all our platforms, but which shouldn't really
be in anyone's mental model of UnsafePointer).
I'd like to no
> On Mar 28, 2016, at 4:47, fukurokujo via swift-evolution
> wrote:
>
>> * 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 addres
Thinking through this proposal, I really favor the operator approach rather
than adding these conversions so my vote is -1.
(If you really know what you're doing you can already do an unsafeBitCast so
this isn't a problem I've had in the real world)
>Because some of these operations are defined
on Thu Mar 24 2016, Guillaume Lessard wrote:
>> * 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 thi
> * 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
Just for note, an alternative that works right now (whether intentional or not)
is this:
let rawAddress: Int = UnsafeMutablePointer(nil).distanceTo(myPointer)
This gives the distance in bytes (so on 95% of all platforms, the raw address).
It currently isn't clear that this is how you can accomp
> On Mar 22, 2016, at 9:35 PM, Chris Lattner via swift-evolution
> wrote:
>
> Hello Swift community,
>
> 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:
>
>
> * What is your evaluation of the proposal?
+1
> * Is the problem being addressed significant enough to warrant a change
> to Swift?
Yes, the current-state leaves one unable to do certain things in pure Swift
(e.g. tagged pointers) that are clearly useful on occasion.
> * D
10 matches
Mail list logo