[swift-evolution] Pitch: Improved Swift pointers

Andrew Trick atrick at apple.com
Tue Jul 18 15:33:20 CDT 2017

> On Jul 18, 2017, at 11:36 AM, Taylor Swift <kelvin13ma at gmail.com> wrote:
> > fix the ordering of the arguments in initializeMemory<Element>(as:at:count:to:)
> I think this ordering was an attempt to avoid confusion with binding
> memory where `to` refers to a type. However, it should be consistent
> with `UnsafePointer.initialize`, so we need to pick one of those to
> change.
> This would be a non-issue had we just been consistent with the rest of the stdlib and named this argument `repeating:` instead of `to:`. But `ptr.initialize(repeating: 255, count: 100)` doesn’t read quite as naturally in English as `ptr.initialize(to: 255, count: 100)` which is why I left this idea out of the proposal. Now that you mention the problem with `initializeMemory<Element>(as:at:count:to:)`, it might be a good idea to add this rename back into it.

I think `repeating` is much more clear.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170718/558e6aaa/attachment.html>

More information about the swift-evolution mailing list