[swift-evolution] [Pitch/Reality Check] Allow instance members as parameter default values

Nate Cook natecook at gmail.com
Wed Feb 22 12:42:48 CST 2017


Oops, left out that there's this horrifying way of writing it right now:

extension Collection {
    func index(_ i: Index! = nil, offsetBy n: IndexDistance) -> Index {
        let i = i ?? startIndex
        // ...
    }
}

Nobody wants that.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170222/5a4449cd/attachment.html>


More information about the swift-evolution mailing list