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

Dave Abrahams dabrahams at apple.com
Wed Jun 8 14:01:30 CDT 2016


on Wed May 18 2016, Brent Royal-Gordon <swift-evolution at swift.org> wrote:

>>> If we're doing this, I wonder if category 1 shouldn't just be
>> `Convertible`. This would preserve our `LiteralConvertible`
>> protocols with the same names (which, consistency issues aside, seem
>> perfectly cromulent), while shifting the `StringConvertible`
>> protocols over to the `Representable` category.
>> 
>> Do you really think 'Convertible' is more clear than 'Initializable'?
>
> 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.

Convertible also tends to implies some semantics, whereas Initializable
just describes a valid syntax.  Protocols that merely describe what
you're allowed to write in code but nothing about its meaning are
usually a bad idea.

-- 
Dave



More information about the swift-evolution mailing list