<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 18, 2017, at 9:42 PM, Taylor Swift <<a href="mailto:kelvin13ma@gmail.com" class="">kelvin13ma@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">How do we feel about changing the label to `repeated:`, even in cases where `count:` is 1?<br class=""><br class=""></div><div class="">This would mean that calls would read like this: `<span style="font-family:monospace,monospace" class="">ptr.initialize(repeated: value)</span>`<br class=""></div></div></div></blockquote><div><br class=""></div>Right. Given the default `count` of 1, it’s probably best to stick with `to: value`.</div><div>-Andy<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div>A grep through the stdlib shows that this is by far the most common use case:<br class=""><br class=""><font size="1" class=""><span style="font-family:monospace,monospace" class="">swift-source/swift$ grep initialize\(to: . -r<br class="">./stdlib/private/SwiftPrivatePthreadExtras/SwiftPrivatePthreadExtras.swift: result.initialize(to: block(arg))<br class="">./stdlib/private/StdlibUnittest/OpaqueIdentityFunctions.swift: ptr.initialize(to: x)<br class="">./stdlib/private/SwiftReflectionTest/SwiftReflectionTest.swift: anyPointer.initialize(to: any)<br class="">./stdlib/private/SwiftReflectionTest/SwiftReflectionTest.swift: fn.initialize(to: ThickFunction0(function: function))<br class="">./stdlib/private/SwiftReflectionTest/SwiftReflectionTest.swift: fn.initialize(to: ThickFunction1(function: function))<br class="">./stdlib/private/SwiftReflectionTest/SwiftReflectionTest.swift: fn.initialize(to: ThickFunction2(function: function))<br class="">./stdlib/private/SwiftReflectionTest/SwiftReflectionTest.swift: fn.initialize(to: ThickFunction3(function: function))<br class="">./stdlib/private/SwiftPrivate/ShardedAtomicCounter.swift: (shards + i).initialize(to: 0)<br class="">./stdlib/public/SDK/Foundation/NSError.swift: out.initialize(to: bridged)<br class="">./stdlib/public/core/UnsafeRawPointer.swift.gyb: // (self.assumingMemoryBound(to: T.self) + i).initialize(to: source[i])<br class="">./stdlib/public/core/UnsafeRawPointer.swift.gyb: // .initialize(to: (source + i).move())<br class="">./stdlib/public/core/UnsafeRawPointer.swift.gyb: // (--dst).initialize(to: (--src).move())<br class="">./stdlib/public/core/Arrays.swift.gyb: p.initialize(to: repeatedValue)<br class="">./stdlib/public/core/Arrays.swift.gyb: (_buffer.firstElementAddress + oldCount).initialize(to: newElement)<br class="">./stdlib/public/core/Arrays.swift.gyb: p.initialize(to: x)<br class="">./stdlib/public/core/Arrays.swift.gyb: p.initialize(to: newValues[q])<br class="">./stdlib/public/core/Arrays.swift.gyb: (base + newCount).initialize(to: next)<br class="">./stdlib/public/core/AnyHashable.swift: result.initialize(to: value)<br class="">./stdlib/public/core/AnyHashable.swift: result.initialize(to: value)<br class="">./stdlib/public/core/AnyHashable.swift: target.initialize(to: AnyHashable(value))<br class="">./stdlib/public/core/ArrayCast.swift: target.initialize(to: _arrayForceCast(source.pointee))<br class="">./stdlib/public/core/ArrayCast.swift: target.initialize(to: result)<br class="">./stdlib/public/core/ContiguousArrayBuffer.swift: (resultPtr + i).initialize(to: _bridgeAnythingToObjectiveC(p[i]))<br class="">./stdlib/public/core/ContiguousArrayBuffer.swift: p.initialize(to: source[i])<br class="">./stdlib/public/core/ContiguousArrayBuffer.swift: p.initialize(to: element)<br class="">./stdlib/public/core/ArrayBuffer.swift: result.initialize(to: result.pointee)<br class="">./stdlib/public/core/HashedCollections.swift.gyb: target.initialize(to: _setDownCast(source.pointee))<br class="">./stdlib/public/core/HashedCollections.swift.gyb: target.initialize(to: result)<br class="">./stdlib/public/core/HashedCollections.swift.gyb: target.initialize(to: _dictionaryDownCast(source.pointee))<br class="">./stdlib/public/core/HashedCollections.swift.gyb: target.initialize(to: result)<br class="">./stdlib/public/core/HashedCollections.swift.gyb: (keys + i).initialize(to: k)<br class="">./stdlib/public/core/HashedCollections.swift.gyb: (keys + toEntryAt).initialize(to: (from.keys + at).move())<br class="">./stdlib/public/core/HashedCollections.swift.gyb: (keys + i).initialize(to: k)<br class="">./stdlib/public/core/HashedCollections.swift.gyb: (values + i).initialize(to: v)<br class="">./stdlib/public/core/HashedCollections.swift.gyb: (keys + toEntryAt).initialize(to: (from.keys + at).move())<br class="">./stdlib/public/core/HashedCollections.swift.gyb: (values + toEntryAt).initialize(to: (from.values + at).move())<br class="">./stdlib/public/core/ReflectionLegacy.swift: out.initialize(to: String(reflecting: x))<br class=""><br class="">./stdlib/public/core/ManagedBuffer.swift: p.headerAddress.initialize(to: initHeaderVal)<br class="">./stdlib/public/core/ManagedBuffer.swift: $0.initialize(to: <br class="">./stdlib/public/core/ArrayBufferProtocol.swift: (elements + j).initialize(to: newValues[i])<br class="">./stdlib/public/core/Sequence.swift: ptr.initialize(to: x)<br class="">./stdlib/public/core/HeapBuffer.swift: $0.initialize(to: Header(initializer))<br class="">./stdlib/public/core/UnsafeBitMap.swift: values.initialize(to: 0, count: numberOfWords)<br class="">./stdlib/public/core/String.swift: resultStorage.initialize(to: <br class="">./test/api-digester/stdlib-stable.json: "printedName": "initialize(to:count:)",<br class="">./test/Generics/slice_test.swift: (newbase + i).initialize(to: (base+i).move())<br class="">./test/Generics/slice_test.swift: (base+length).initialize(to: elem)<br class="">./test/Parse/pointer_conversion.swift.gyb: p.initialize(to: t)<br class=""><br class="">./test/stdlib/Reflection.swift:sanePointerString.initialize(to: "Hello panda")<br class=""><br class="">./test/stdlib/Builtins.swift: (buf + 0).initialize(to: value)<br class="">./test/stdlib/Builtins.swift: (buf + 1).initialize(to: value)<br class="">./test/stdlib/Renames.swift: x.initialize(e) // expected-error {{'initialize' has been renamed to 'initialize(to:)'}} {{5-15=initialize}} {{16-16=to: }} {{none}}<br class="">./test/stdlib/Renames.swift: x.initialize(with: e) // expected-error {{'initialize(with:count:)' has been renamed to 'initialize(to:count:)'}} {{5-15=initialize}} {{16-20=to}} {{none}}<br class="">./test/stdlib/Renames.swift: ptr1.initialize(with: e, count: 1) // expected-error {{'initialize(with:count:)' has been renamed to 'initialize(to:count:)'}} {{8-18=initialize}} {{19-23=to}} {{none}}<br class="">./test/Sanitizers/asan.swift:a.initialize(to: 5)<br class="">./validation-test/stdlib/UnsafeBufferPointer.swift.gyb: allocated.initialize(to: 1.0, count: count)<br class="">./validation-test/stdlib/UnsafeBufferPointer.swift.gyb: allocated.initialize(to: 1.0, count: count)<br class="">./validation-test/stdlib/StringSlicesConcurrentAppend.swift: barrierVar!.initialize(to: _stdlib_pthread_barrier_t())<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: (_keyVector(layout: layout) + keyCount).initialize(to: key)<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: (_valueVector(layout: layout) + keyCount).initialize(to: value)<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: (_valueArray + i).initialize(to: value)<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: keyArray.initialize(to: key0)<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: (keyArray + 1).initialize(to: key1)<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: valueArray.initialize(to: value0)<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: (valueArray + 1).initialize(to: value1)<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: (_keyArray + i).initialize(to: key)<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: (_valueArray(layout: layout) + i).initialize(to: value)<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: (keyArray + layout.keyCount - 1).initialize(to: appendKey)<br class="">./validation-test/stdlib/Prototypes/PersistentVector.swift.gyb: (valueArray + layout.keyCount - 1).initialize(to: appendValue)<br class="">./validation-test/compiler_crashers_2_fixed/0004-rdar20564605.swift: p.initialize(to: element)<br class="">./validation-test/compiler_crashers_2_fixed/0003-rdar20564378.swift: p.initialize(to: element)<br class="">./validation-test/compiler_crashers_2_fixed/0006-rdar20588474.swift: p.initialize(to: element)<br class="">./validation-test/compiler_crashers_2_fixed/0010-rdar20638881.swift: p.initialize(to: element)<br class=""></span></font><br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jul 18, 2017 at 4:33 PM, Andrew Trick <span dir="ltr" class=""><<a href="mailto:atrick@apple.com" target="_blank" class="">atrick@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><span class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 18, 2017, at 11:36 AM, Taylor Swift <<a href="mailto:kelvin13ma@gmail.com" target="_blank" class="">kelvin13ma@gmail.com</a>> wrote:</div><br class="m_-907934889053787745Apple-interchange-newline"><div class=""><blockquote class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class=""><div class="">> fix the ordering of the arguments in initializeMemory<Element>(as:a<wbr class="">t:count:to:)</div><div class=""><br class=""></div><div class="">I think this ordering was an attempt to avoid confusion with binding</div><div class="">memory where `to` refers to a type. However, it should be consistent</div><div class="">with `UnsafePointer.initialize`, so we need to pick one of those to</div><div class="">change.</div></div></blockquote><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><br class=""></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">This would be a non-issue had we just been consistent with the rest of the stdlib and named this argument `<span style="font-family:monospace,monospace" class="">repeating:</span>` instead of `<span style="font-family:monospace,monospace" class="">to:</span>`. But `<span style="font-family:monospace,monospace" class="">ptr.initialize(repeating: 255, count: 100)</span>` doesn’t read quite as naturally in English as `<span style="font-family:monospace,monospace" class="">ptr.initialize(to: 255, count: 100)</span>` which is why I left this idea out of the proposal. Now that you mention the problem with `<span style="font-family:monospace,monospace" class="">initializeMemory<Element>(as:</span><span style="font-family:monospace,monospace" class=""><wbr class="">at:count:to:)</span>`, it might be a good idea to add this rename back into it.</div></div></blockquote></div><br class=""></span><div class="">I think `repeating` is much more clear.</div><div class=""><br class=""></div><div class="">-Andy</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>