I don't mind `initialize(from:forwardToCount:)`, but I do have trouble with Brent's suggestion of `initialize(from:backwardFromCount:)`. It adds ambiguity as to whether the pointer in the first argument points to the 0th element or the (count - 1)th element from which initializing is proceeding backward, a problem that does not exist with the currently proposed version `initializeBackward(from:count:)`. I don't find the symmetry wins compelling enough to overcome that additional ambiguity.
On Tue, Jul 5, 2016 at 10:23 Andrew Trick via swift-evolution < [email protected]> wrote: > > On Jul 2, 2016, at 10:10 PM, Brent Royal-Gordon via swift-evolution < > [email protected]> wrote: > > I have a pile of naming quibbles; rather than describe them all in prose > (which turned into a mess), I've annotated parts of the "Full > UnsafeRawPointer API" section in a gist: < > https://gist.github.com/brentdax/8f4ed4decafc1d18c4441092baa13cfe>. > > > I want to call this out separately because it’s not specific to my > proposal and changes the existing UnsafePointer API. > > Brent’s suggestion is to change `initialize(from:count:)` to > `initialize(from:forwardToCount:)` for symmetry with the backward > operations. It makes perfect sense to me, and it does a better job of > conveying that a sequence of elements will be read out of “from”. > > Any objections? > > // I'm not happy with the asymmetry of these forwards/backwards > // pairs. > // > // func initialize<T>(from: UnsafePointer<T>, count: Int) > // -> UnsafeMutablePointer<T> > // func initializeBackward<T>(from: UnsafePointer<T>, count: Int) > // -> UnsafeMutablePointer<T> > func initialize<T>(from: UnsafePointer<T>, forwardToCount: Int) > -> UnsafeMutablePointer<T> > func initialize<T>(from: UnsafePointer<T>, backwardFromCount: Int) > -> UnsafeMutablePointer<T> > > // More detailed thoughts on redesigining `move` methods in the > // email, but for now: > // > // func moveInitialize<T>(from: UnsafePointer<T>, count: Int) > // -> UnsafeMutablePointer<T> > // func moveInitializeBackward<T>(from: UnsafePointer<T>, count: Int) > // -> UnsafeMutablePointer<T> > func moveInitialize<T>(from: UnsafePointer<T>, forwardToCount: Int) > -> UnsafeMutablePointer<T> > func moveInitialize<T>(from: UnsafePointer<T>, backwardFromCount: Int) > -> UnsafeMutablePointer<T> > > Andy > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
