[swift-evolution] [Proposal Draft] Literal Syntax Protocols

Vladimir.S svabox at gmail.com
Fri Jul 1 15:51:00 CDT 2016


On 01.07.2016 23:39, Xiaodi Wu via swift-evolution wrote:
> I thought your suggestion of IntegerLiteralExpressible (with or without
> Syntax) was nice too.

Support. I still believe that Syntax.IntegerLiteralExpressible is the best.
We see 'Syntax' first, then 'Integer' just after point, 'Expressible' at 
the end. Easily parsed and IMO clear about the meaning.
Probably this also good but not sure: Syntax.LiteralExpressible.Integer

> On Fri, Jul 1, 2016 at 15:35 Dave Abrahams via swift-evolution
> <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>
>
>     on Fri Jul 01 2016, Erica Sadun <erica-AT-ericasadun.com> wrote:
>
>     > The best way to pass the Dave Test is to ask him directly, for example:
>     >
>     > Dave:
>     >
>     > Do you think the stdlib team would be okay with a naming scheme like
>     > Syntax.Literal.ArrayProtocol,  Syntax.Literal.IntegerProtocol, etc.
>     We think
>     > this produces a clear description of the conformant role and one that
>     is unlikely to be
>     > misinterpreted. It may read less fluently but it's also less subject
>     > to confusing users.
>
>     No.  IMO Putting “Protocol” in the name just adds redundant type
>     information that doesn't help readability.
>
>     > This naming scheme uses the Syntax namespacing, and creates a Literal
>     > subspace.  Each protocol is named as "XXXXProtocol". This introduction
>     > a distinction between "This is/can be used as an integer literal" and
>     > "Conforming to this protocol ensures that an instance of the type can
>     > be written as an integer literal".
>     >
>     > The problem with earlier approximations was that people saw
>     > "Syntax.IntegerLiteralXXX" and thought the typed could be substituted
>     > into expressions where an integer literal was used, and not that an
>     > integer literal could be be used to write an instance of the type.
>     >
>     > So what do (and your team) think of this idea?
>
>     I think if `Syntax.IntegerLiteral` is actually unclear then the best
>     cure is `ExpressibleAsIntegerLiteral` (no namespace needed).  None of
>     the other suggestions I've seen describe what the protocol means as well
>     as that.  I've asked Matthew to update the proposal accordingly.
>
>     >
>     > -- Adrian (and Erica)
>     >
>     >> On Jul 1, 2016, at 2:08 AM, Adrian Zubarev via swift-evolution
>     <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>     >>
>     >> We haven’t pass the dave test yet? :D
>     >>
>     >> Still curious what he’d say about Syntax.Literal.*Protocol
>     >>
>     >> One more question:
>     >>
>     >> What can the namespace Syntax could be used for except for literals,
>     any idea? (I have no clue.)
>     >
>
>     --
>     Dave
>     _______________________________________________
>     swift-evolution mailing list
>     swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>     https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>


More information about the swift-evolution mailing list