[swift-evolution] Revisiting SE-0041 Names

Matthew Johnson matthew at anandabits.com
Wed Jun 22 18:43:46 CDT 2016


> On Jun 22, 2016, at 1:55 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> 
> On Wed, Jun 22, 2016 at 11:04 AM, Erica Sadun via swift-evolution
> <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> Proposal:
>> https://github.com/apple/swift-evolution/blob/master/proposals/0041-conversion-protocol-conventions.md
>> 
>> Rejection: "The feedback on the proposal was generally positive about the
>> idea of renaming these protocols, but the specific names in the proposal are
>> not well received, and there is no apparent confluence in the community on
>> better names.  The core team prefers discussion to continue -- if/when there
>> is a strong proposal for a better naming approach, we can reconsider
>> renaming these."
>> 
>> John McCall: "To be clear, I don't care about the name.  If you want to
>> rename IntegerLiteralConvertible to IntegerLiteral or whatever, I won't drag
>> the conversation into the muck again. :)  It's the design of the
>> requirements that I'm pretty opposed to revisiting."
>> 
>> The Problem: This is really the last chance to rationalize this across the
>> language and to evaluate whether other protocol groups should have a core
>> scheme for naming.
> 
> Hi Erica,
> 
> I would like to re-state the feedback from Dave Abrahams, Max Moiseev
> and me from the last time this was discussed.  Unfortunately I can't
> find the exact email, so I can't provide a link.
> 
> - The "literal" protocols are not about conversion, they are about
> adopting a certain syntax provided by the language.  "Convertible" in
> the name is a red herring: a type can't be convertible from an integer
> literal because there is no "IntegerLiteral" entity in the type
> system.  The literal *becomes* typed as the corresponding literal type
> (e.g., Int or String), and as far as the user at the call site is
> concerned, there is no visible conversion (even if one is happening
> behind the scenes).
> 
> Our suggestion was to focus on the "adopting the syntax" part.  We
> suggested moving the "literal convertible" protocols into a
> pseudo-namespace "Syntax".  It could be implemented like this:
> 
> protocol _IntegerLiteralSyntax {}
> enum Syntax {
>  typealias IntegerLiteral = _IntegerLiteralSyntax
> }
> 
> And used like this:
> 
> struct Int : Syntax.IntegerLiteral {}

Is anyone on the core team planning to write up a proposal for this change?  If not, I will be happy to do it.  It solves the biggest issue I have with the current state (two different meanings for “Convertible”).  I will be happy to see this solved while we’re making breaking changes. :)

> 
> - For protocols that are representing conversions between types that
> actually exist in the library, there is not enough precedent yet to
> make a general conclusion and standardize a pattern.
> 
> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com <mailto:gribozavr at gmail.com>>*/

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


More information about the swift-evolution mailing list