[swift-evolution] [swift-evolution-announce] [Review] SE-0041: Updating Protocol Naming Conventions for Conversions

Pyry Jahkola pyry.jahkola at iki.fi
Wed May 18 14:34:23 CDT 2016


> On 18 May 2016, Brent Royal-Gordon wrote:
> 
> I don't think `Convertible` is clearer than `Initializable`, but I think it rolls off the tongue better, is easier to spell, is more compatible with non-initializer implementations, and in general wins on a lot of squishy, subjective, hard-to-define axes.
> 
> Subjectively, I've noticed that a lot of people *don't* think of things like `Double(myFloat)` as being initializers; they think of them as conversions. To those people, `Convertible` is probably the right name.

Isn't it odd that we use four different terms for both kinds of String conversions that we have?

    A1: extension Foo : CustomStringConvertible // proposed: CustomStringRepresentable
    A2: foo.description
    A3: String(foo) // or `String(printing: foo)` if SE-0089 gets accepted
    A4: print(foo)

    B1: extension Foo : CustomDebugStringConvertible // proposed: CustomDebugStringRepresentable
    B2: foo.debugDescription
    B3: String(reflecting: foo)
    B4: debugPrint(foo)

I don't have great suggestions but wouldn't it be better to move the naming of cases 1 & 2 towards the words used in cases 3 & 4?

— Pyry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160518/6da456ef/attachment.html>


More information about the swift-evolution mailing list