<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 24, 2016 at 2:50 PM, Matthew Johnson via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Jun 24, 2016, at 10:41 AM, Adrian Zubarev via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><p style="margin:15px 0px">That said, how about this design:</p><pre style="margin:15px 0px;font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);color:inherit;border:1px solid rgb(204,204,204);overflow:auto;padding:4px 8px;word-break:normal;word-wrap:normal"><code style="font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);color:inherit;border:0px;margin:0px;padding:0px;word-break:normal;word-wrap:normal">public protocol _LiteralNilProtocol { … }


public enum Literal {
     
    public typealias NilProtocol = …
    …
}</code></pre></div></div></blockquote></span>I’m pretty sure the standard library team intends to reserve the right to use this namespace for other protocols that only exist for syntactic support.  This may not always be literals - there may be other kinds of syntax supporting protocols in the future.  With that in mind I don’t think this design will work.</div></div></blockquote><div><br></div><div>That said, `IntegerLiteralProtocol` or `Syntax.IntegerLiteralProtocol` both read very nicely, IMO, so that aspect of the idea is worth considering.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div class="h5"><br><blockquote type="cite"><div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><pre style="margin:15px 0px;font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);color:inherit;border:1px solid rgb(204,204,204);overflow:auto;padding:4px 8px;word-break:normal;word-wrap:normal"><code style="font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);color:inherit;border:0px;margin:0px;padding:0px;word-break:normal;word-wrap:normal">extension Array: Literal.ArrayProtocol  
</code></pre><div style="margin:15px 0px"><br></div></div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><div style="font-family:Helvetica,Arial;font-size:13px;margin:0px"><br></div><br><div><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div><br><p style="margin:15px 0px">Am 24. Juni 2016 um 17:37:27, Adrian Zubarev (<a href="mailto:adrian.zubarev@devandartist.com" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">adrian.zubarev@devandartist.com</a>) schrieb:</p><blockquote type="cite" style="margin:15px 0px"><span style="margin-top:0px;margin-bottom:0px"><div style="word-wrap:break-word"><div></div><div><div><p style="margin:15px 0px">Really? I must have overlooked that some pitched that design.</p><p style="margin:15px 0px">Okay now that I think through this whole scenario, I like the underscore iff there is a good name that will be present in the final version.</p><p style="margin:15px 0px">When Swift 3 drops, I’ll write a proposal for nested protocols which will refine your design (the original author went missing after pitching this idea, and Joe Groff told me that this probably out of scope for Swift 3)!</p><p style="margin:15px 0px">Your current design might become this in Swift 3.X and all protocols marked with an underscore will disappear:</p><pre style="margin:15px 0px;font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);color:inherit;border:1px solid rgb(204,204,204);overflow:auto;padding:4px 8px;word-break:normal;word-wrap:normal"><code style="font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);color:inherit;border:0px;margin:0px;padding:0px;word-break:normal;word-wrap:normal">public /* closed */ enum Syntax {
  public protocol NilLiteral { ... }
  public protocol BooleanLiteral { ... }
  public protocol IntegerLiteral { ... }
  public protocol FloatLiteral { ... }
  public protocol UnicodeScalarLiteral { ... }
  public protocol ExtendedGraphemeClusterLiteral { ... }
  public protocol StringLiteralLiteral { ... }
  public protocol StringInterplolationLiteral { ... }
  public protocol ArrayrLiteral { ... }
  public protocol DictionaryLiteral { ... }
}
</code></pre></div><div><div style="font-family:Helvetica,Arial;font-size:13px;margin:0px"><br></div><br><div><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div><br><p style="margin:15px 0px">Am 24. Juni 2016 um 17:25:45, Matthew Johnson (<a href="mailto:matthew@anandabits.com" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">matthew@anandabits.com</a>) schrieb:</p><blockquote type="cite" style="margin:15px 0px"><div style="margin-top:0px;margin-bottom:0px;word-wrap:break-word"><div><div><span>The design in this proposal comes from the standard library team.  The intent is for the use of underscore here to be consistent with other uses of underscore prefix in the standard library.  I’m not sure why you think this is different than the rest...</span></div><div><span><br></span></div><span><br></span><div><blockquote type="cite" style="margin:15px 0px"><div style="margin-top:0px"><span>On Jun 24, 2016, at 10:22 AM, Adrian Zubarev via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</span></div><span><br></span><div style="margin-bottom:0px"><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><p style="margin:15px 0px"><span>I’m aware of that fact, but all types with underscore even in the stdlib telling me to keep my hands of them, because something might happen to them.</span></p><div><span>As an example we have <code style="font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);color:inherit;border:1px solid rgb(234,234,234);margin:0px 2px;padding:0px 5px;word-break:normal;word-wrap:normal">_Strideable</code> protocol which is visible by its name, but its declaration isn’t visible at all:</span></div></div></div></blockquote><blockquote type="cite" style="margin:15px 0px"><div style="margin-top:0px;font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><pre style="margin:15px 0px;font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);color:inherit;border:1px solid rgb(204,204,204);overflow:auto;padding:4px 8px;word-break:normal;word-wrap:normal"><span><code style="font-family:Menlo,Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:10pt;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(248,248,248);color:inherit;border:0px;margin:0px;padding:0px;word-break:normal;word-wrap:normal">// FIXME(ABI)(compiler limitation): Remove `_Strideable`.
// WORKAROUND <a style="color:rgb(65,131,196);background-color:inherit;text-decoration:none">rdar://25214598</a> - should be:
// protocol Strideable : Comparable {...}

% for Self in [&#39;_Strideable&#39;, &#39;Strideable&#39;]:
</code></span></pre><p style="margin:15px 0px"><span>From<span> </span><a href="https://github.com/apple/swift/blob/63c36dff0a327874a5041d46335bde314bc108d8/stdlib/public/core/Stride.swift.gyb" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">Stride.swift.gyb</a></span></p><div style="margin:15px 0px"><br></div></div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><div style="font-family:Helvetica,Arial;font-size:13px;margin:0px"><br></div><br><div><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div><br><p style="margin:15px 0px">Am 24. Juni 2016 um 17:09:53, Matthew Johnson (<a href="mailto:matthew@anandabits.com" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" target="_blank">matthew@anandabits.com</a>) schrieb:</p><blockquote type="cite" style="margin:15px 0px"><div style="margin-top:0px;margin-bottom:0px"><span style="margin-top:0px;margin-bottom:0px"><span style="font-family:&#39;helvetica Neue&#39;,helvetica;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);float:none;display:inline!important">The underscore is used in the same way it is used elsewhere in the standard library.  The protocols must be public because they need to be visible to user code in order for the design to work correctly.  However, they are considered implementation details that users really shouldn’t know about.  This pattern is well established in the standard library.</span></span></div></blockquote></div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><div style="margin:15px 0px"><br></div></div><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254);float:none;display:inline!important">_______________________________________________</span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254);float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:rgb(254,254,254);text-decoration:none;font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color:rgb(65,131,196);background-color:rgb(254,254,254);text-decoration:none;font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br style="margin-bottom:0px;font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"></blockquote></div><br></div></div></blockquote></div><div></div></div></div></span></blockquote></div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><div style="margin:15px 0px"><br></div></div><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254);float:none;display:inline!important">_______________________________________________</span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254);float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254);float:none;display:inline!important"><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254);float:none;display:inline!important"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(254,254,254)"></div></blockquote></div></div></div><br></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>