> On Jul 2, 2016, at 8: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 
> <https://gist.github.com/brentdax/8f4ed4decafc1d18c4441092baa13cfe>>.
> 


Let's bikeshed this easy one now... I’m curious what others think:

  // In general, I think you "initialize to" a value, not 
  // "initialize with" a value. "with" is needlessly vacuous.
  // 
  // func initialize<T>(_: T.Type, with: T, count: Int = 1)
  //   -> UnsafeMutablePointer<T>
  func initialize<T>(_: T.Type, to: T, count: Int = 1)
    -> UnsafeMutablePointer<T>

`initialize` was recently renamed to `initialized(with:)`.

commit d96b051d28b6042adcc8b8692a918abddf211aec
Author: Dave Abrahams <[email protected]>
Date:   Tue Feb 23 15:12:24 2016 -0800

    stdlib: initializePointee(_) => initialize(with:)
    
    Tacking "Pointee" on just for unary operations (and especially
    operations with an optional count) created inconsistency.

So Swift 3 users have already migrated to this “better” name.

I agree that initialize(to:) is consistent with the language we use for 
assigning values. But grammatically, I think initialize(with:) also makes 
perfect sense and is just as common.

In general, if there’s controversy, I’ll stick with the existing conventions 
because there’s already enough to debate in this proposal.

-Andy
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to