[swift-evolution] Pitch: Improved Swift pointers

Dave Abrahams dabrahams at apple.com
Sat Sep 9 12:19:22 CDT 2017


 
on Wed Aug 09 2017, Xiaodi Wu 
<swift-evolution at swift.org> wrote: 
 
> On Wed, Aug 9, 2017 at 8:22 PM, Brent Royal-Gordon via 
> swift-evolution < 
> swift-evolution at swift.org> wrote: 
> 
>> On Jul 19, 2017, at 11:21 AM, Taylor Swift via swift-evolution 
>> < swift-evolution at swift.org> 
>> wrote: 
>> 
>> What about `value:`? 
>> 
>> `ptr.initialize(value: value)` `ptr.initialize(value: value, 
>> count: 13)` `ptr.initialize(as: UInt16.self, at: 0, value: 
>> value, count: 13)` 
>>  
>> Doesn't read as a sentence. Consider how "initialize to 3" 
>> sounds different from "initialize value 3". 
>> 
>> Personally, I'd go with: 
>> 
>> ptr.initialize(to: value) ptr.initialize(to: value, 
>> repeatCount: 3) 
>> 
>> (Or just `repeat`/`repeating` if you don't feel like you need 
>> the word "count" to disambiguate.) 
>> 
> 
> Per Swift API naming guidelines, initializers don't have to read 
> as sentences IIRC, and I'd be inclined to grant a function named 
> `initialize(_:)` the same courtesy. 

I know it's late to chime in here, but: that's not an initializer.

-- 
-Dave



More information about the swift-evolution mailing list