[swift-evolution] Proposal: conversion protocol naming conventions

Brent Royal-Gordon brent at architechies.com
Tue Dec 15 17:30:02 CST 2015


>>> 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 {…}

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list