on Wed Jun 22 2016, David Sweeris <swift-evolution@swift.org> wrote:
>> On Jun 22, 2016, at 1:55 PM, Dmitri Gribenko via swift-evolution >> <swift-evolution@swift.org> wrote: >> >> On Wed, Jun 22, 2016 at 11:04 AM, Erica Sadun via swift-evolution >> <swift-evolution@swift.org> wrote: >> > >> 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 {} >> >> - 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. > > I’m not sure I understand… In this example, has > “IntegerLiteralConvertible” been renamed to “_IntegerLiteralSyntax”? Yes, that's the idea. -- Dave _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution