[swift-evolution] Proposal: conversion protocol naming conventions

Matthew Johnson matthew at anandabits.com
Tue Dec 15 17:40:21 CST 2015


I really like Creatable for the first as it is general enough to handle initializers an factory methods.  Great idea!  Alternatively, we could use that for a fourth category covering factory methods and stick with Initializable for the first case.

> On Dec 15, 2015, at 5:30 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>>>> resentable is probably a lot better than CustomStringRepresentationExpressible
>>> 
>>> Representable is what I would have used if I wasn't trying to make a minimal change or if RawRepresentable didn't already use it for bidirectional conversion, so I agree that it is better than both Expressible and Projectable.
>> 
>> Let's run with the idea that everything is up for grabs and that better names will better serve the developer community in the long run. In such a case, if the core naming patterns were established as Convertible for bidirectional conversion, would RawConvertible be such a bad thing?
> 
> I actually think `Representable` better implies two-way than `Convertible` does. A representation is a way of expressing something in a different form; a conversion is a specific act of transforming one thing to another. To me, the former sounds more like a round trip than the latter.
> 
> So I suggest:
> 
> 	protocol IntegerLiteralInitializable {...} // or maybe ‘Creatable’, to cover the factory method case?
> 	
> 	protocol RawRepresentable {…}
> 	
> 	protocol CustomStringConvertible {…}
> 





More information about the swift-evolution mailing list