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

David Waite david at alkaline-solutions.com
Wed May 11 00:12:26 CDT 2016


> The review of "SE-0041: Updating Protocol Naming Conventions for Conversions" begins now and runs through May 16. The proposal is available here:
> 	https://github.com/apple/swift-evolution/blob/master/proposals/0041-conversion-protocol-conventions.md <https://github.com/apple/swift-evolution/blob/master/proposals/0041-conversion-protocol-conventions.md>

> 	* What is your evaluation of the proposal?
-1.

I’m not 100% sure on the names (can we paint the bike shed plaid?) but more importantly, I’m not sure the groupings are adequate

RawRepresentable seems to represent a sub-type declaring a super type coercion system.

The various literal-based initializers are not necessarily coercion operators - some operations (e.g. initializing a Set from a literal with repeating elements) are lossy. These initializers also are not given a mechanism to recover from failure (possibly because the literals mean that failure represents a precondition failure in the written code?). That would imply that these literal-based initializers are special - a non-literal needs failure-reporting semantics.

CustomStringRepresentable is not meant for any sort of type conversion. It returns a user presentation of the object as text (while the Debug variant is meant to return a developer presentation)

So I don’t feel these represent In, Out, and InOut but instead three different classifications of conversions.

> 	* Is the problem being addressed significant enough to warrant a change to Swift?
Now is a great time for naming consistency

> 	* Does this proposal fit well with the feel and direction of Swift?
Future direction there may be another change if coercion is defined as a language feature (such as implicit numeric coercion)

> 	* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
I thought of Ruby and the difference between to_s and to_str.  The idea of a representation as a type vs coercion to a type is a hard one to learn.

> 	* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
A quick reading.

-DW
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160510/0035db7d/attachment.html>


More information about the swift-evolution mailing list