Re: [swift-evolution] [Pitch] UnsafePointer.advanced(to:)

2017-06-06 Thread Dave Abrahams via swift-evolution
It's not an offset because the result is a different type of thing than the source Sent from my moss-covered three-handled family gradunza > On Jun 6, 2017, at 1:09 PM, Hooman Mehr wrote: > > >> On Jun 6, 2017, at 12:56 PM, Dave Abrahams via swift-evolution >> wrote: >> >> >> on Tue Jun

Re: [swift-evolution] [Pitch] UnsafePointer.advanced(to:)

2017-06-06 Thread Hooman Mehr via swift-evolution
> On Jun 6, 2017, at 12:56 PM, Dave Abrahams via swift-evolution > wrote: > > > on Tue Jun 06 2017, Brent Royal-Gordon > wrote: > >>> On Jun 6, 2017, at 9:06 AM, Xiaodi Wu wrote: >>> >>> Why would this be an extension on UnsafePointer and not KeyPath? >>

Re: [swift-evolution] [Pitch] UnsafePointer.advanced(to:)

2017-06-06 Thread Dave Abrahams via swift-evolution
on Tue Jun 06 2017, Brent Royal-Gordon wrote: >> On Jun 6, 2017, at 9:06 AM, Xiaodi Wu wrote: >> >> Why would this be an extension on UnsafePointer and not KeyPath? > > 1. I can't come up with a name as good as `advanced(to:)` that would > be attached to the key path. I use `advance(_:)` in th

Re: [swift-evolution] [Pitch] UnsafePointer.advanced(to:)

2017-06-06 Thread Brent Royal-Gordon via swift-evolution
> On Jun 6, 2017, at 9:06 AM, Xiaodi Wu wrote: > > Why would this be an extension on UnsafePointer and not KeyPath? 1. I can't come up with a name as good as `advanced(to:)` that would be attached to the key path. I use `advance(_:)` in the other two reasons below, but I don't think it's nearl

Re: [swift-evolution] [Pitch] UnsafePointer.advanced(to:)

2017-06-06 Thread Xiaodi Wu via swift-evolution
Why would this be an extension on UnsafePointer and not KeyPath? On Tue, Jun 6, 2017 at 10:28 Brent Royal-Gordon via swift-evolution < swift-evolution@swift.org> wrote: > It won't happen for Swift 4, but I think we should eventually have APIs > like: > > extension UnsafePointer { > func advanc

[swift-evolution] [Pitch] UnsafePointer.advanced(to:)

2017-06-06 Thread Brent Royal-Gordon via swift-evolution
It won't happen for Swift 4, but I think we should eventually have APIs like: extension UnsafePointer { func advanced(to keyPath: KeyPath) -> UnsafePointer? } If keyPath referred to a stored property directly inside the value, this would return a pointer to that property. If keyPath is a com