<html><head><style>
body {
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        padding:1em;
        margin:auto;
        background:#fefefe;
}
h1, h2, h3, h4, h5, h6 {
        font-weight: bold;
}
h1 {
        color: #000000;
        font-size: 28pt;
}
h2 {
        border-bottom: 1px solid #CCCCCC;
        color: #000000;
        font-size: 24px;
}
h3 {
        font-size: 18px;
}
h4 {
        font-size: 16px;
}
h5 {
        font-size: 14px;
}
h6 {
        color: #777777;
        background-color: inherit;
        font-size: 14px;
}
hr {
        height: 0.2em;
        border: 0;
        color: #CCCCCC;
        background-color: #CCCCCC;
display: inherit;
}
p, blockquote, ul, ol, dl, li, table, pre {
        margin: 15px 0;
}
a, a:visited {
        color: #4183C4;
        background-color: inherit;
        text-decoration: none;
}
#message {
        border-radius: 6px;
        border: 1px solid #ccc;
        display:block;
        width:100%;
        height:60px;
        margin:6px 0px;
}
button, #ws {
        font-size: 12 pt;
        padding: 4px 6px;
        border-radius: 5px;
        border: 1px solid #bbb;
        background-color: #eee;
}
code, pre, #ws, #message {
        font-family: Monaco;
        font-size: 10pt;
        border-radius: 3px;
        background-color: #F8F8F8;
        color: inherit;
}
code {
        border: 1px solid #EAEAEA;
        margin: 0 2px;
        padding: 0 5px;
}
pre {
        border: 1px solid #CCCCCC;
        overflow: auto;
        padding: 4px 8px;
}
pre > code {
        border: 0;
        margin: 0;
        padding: 0;
}
#ws { background-color: #f8f8f8; }
.bloop_markdown table {
border-collapse: collapse;
font-family: Helvetica, arial, freesans, clean, sans-serif;
color: rgb(51, 51, 51);
font-size: 15px; line-height: 25px;
padding: 0; }
.bloop_markdown table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
.bloop_markdown table tr:nth-child(2n) {
background-color: #f8f8f8; }
.bloop_markdown table tr th {
font-weight: bold;
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }
.bloop_markdown table tr td {
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }
.bloop_markdown table tr th :first-child, table tr td :first-child {
margin-top: 0; }
.bloop_markdown table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }
.bloop_markdown blockquote{
border-left: 4px solid #dddddd;
padding: 0 15px;
color: #777777; }
blockquote > :first-child {
margin-top: 0; }
blockquote > :last-child {
margin-bottom: 0; }
code, pre, #ws, #message {
word-break: normal;
word-wrap: normal;
}
hr {
display: inherit;
}
.bloop_markdown :first-child {
-webkit-margin-before: 0;
}
code, pre, #ws, #message {
font-family: Menlo, Consolas, Liberation Mono, Courier, monospace;
}
.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="bloop_markdown"><p>Lets say (and hope) in some future we’ll be able to write functions like this:</p>
<pre><code class="swift">func foo<T: class>(_: T) { /* do something */ }
func foo<T: enum>(_: T) { /* do something */ }
func foo<T: struct>(_: T) { /* do something */ }
// or we might want to have more than one generic types
func foo<A: class, B: enum, C: struct>(_: A, _: B, _: C) {
// do something better
}
// try to use `where` clause with `class A`, `struct C`. It looks ugly to me.
</code></pre>
<p>So ins’t it better to stick to the original syntax and write code like this!?</p>
<pre><code class="swift">protocol MagicType {} // can be applied to any type
protocol ClassType: class {} // only for classes
protocol StructType: struct {} only for structs
protocol ValueType: struct, enum {}
protocol MixedType: struct, class {}
</code></pre>
<p>This is why in my eyes the current syntax for protocols is just perfect.</p>
<p></p></div><div class="bloop_original_html"><style>body{font-family:Helvetica,Arial;font-size:13px}</style><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div> <br> <div id="bloop_sign_1449556337510558208" class="bloop_sign"><div><font face="helvetica, arial">— </font></div><div>Regards Adrian<br></div></div> <br><p class="airmail_on">Am 7. Dezember 2015 bei 23:29:34, Felix Gabel via swift-evolution (<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>) schrieb:</p> <blockquote type="cite" class="clean_bq"><span><div dir="auto"><div></div><div>
<title></title>
<div>Great to hear about being able to apply this to type
parameters and associated types in the future. But I still propose
to rethink the syntax decision. </div>
<div> </div>
<div>class protocol FooType {}</div>
<div><span style="background-color: rgba(255, 255, 255, 0);">typealias class Bar:
FooType</span></div>
<div>func foo<class T>()</div>
<div><br></div>
<div>This is more consistent with for example the declaration of a
class or property</div>
<div><br></div>
<div>Construct name: Type</div>
<div><br>
On 07 Dec 2015, at 23:04, Douglas Gregor via swift-evolution
<<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>
wrote:<br>
<br></div>
<blockquote type="cite">
<div><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Dec 7, 2015, at 8:58 AM, Joe Groff via
swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">
On Dec 7, 2015, at 8:00 AM, Matthew Cheok via swift-evolution
<<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class="">
<br class="">
Currently, we declare class protocols with the following
syntax:<br class="">
<br class="">
protocol TestProtocol: class, OtherProtocol {}<br class="">
<br class="">
This is odd for a few reasons:<br class="">
1) The keyword class exists in the middle of the
declaration<br class="">
2) The keyword class follows the colon and looks a lot like
inheritance<br class="">
3) The keyword class occupies a somewhat arbitrary first position
after the colon (otherwise we have an error)<br class="">
<br class="">
We also have another use of the class keyword as a modifier when
declaring class methods:<br class="">
<br class="">
class func doSomething() {}<br class="">
<br class="">
I’m suggesting a change of syntax that rectifies the above
issues:<br class="">
<br class="">
class protocol TestProtocol: OtherProtocol {}<br class="">
<br class="">
Would love to hear other thoughts on this.<br class=""></blockquote>
<br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The constraint syntax is used because, in the fullness of
time, it should also be applicable to type parameters and
associated types:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">protocol Foo { typealias T: class }</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">func foo<T: class>(x: T)</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div>
</blockquote>
</div>
<div class=""><br class=""></div>
Right. This is exactly the reason why we have the syntax
<div class=""><br class=""></div>
<div class="">protocol X : class { … }</div>
<div class=""><br class=""></div>
<div class="">and why I’m against changing the current
syntax.<br class="">
<div class=""><br class=""></div>
<div class="">- Doug</div>
<div class=""><br class=""></div>
</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=T04LrBojaExXAX0mv-2F2MMtIB9rMFpWjvqf12Pj37IVIQdiJlhqFhPxhoW4X9vomSq4Lb8BPtoy6tsuc7Z-2FPfx-2BPnEHHWg0PcA8l4PIB-2F2Tu4Sm58e8H9F64Tlul3U6zKJIQnbgFKBUujC6Lj6DT2qdu4jJqfeKhy9BF09qIXjUHsc9n6guEjf8v67cSuw8GELmpZv-2Ba0USWU6sLApSSqTQwTDz7dsrYe8pXSYOTqomg-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"></div>
</blockquote>
<blockquote type="cite">
<div>
<span>_______________________________________________</span><br>
<span>swift-evolution mailing list</span><br>
<span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br>
<span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br>
</div>
</blockquote>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=Q0Y0L54uOhrrHtFzGFlMm5JlViMSyhb7WcyBhJqdl-2FFH6e1qNDZ1tyPWzOlZwbqkDLO-2F-2FkeOmNe-2FtqvJvzPKmbLXrZs4XYwWPIzVPHouvezfzkWhzcMo8cEEM5fXJpkruzDQwbRYFGDTf6PynhUnWGfXbsntOCtFF4sGzjwOtjuhrf352Qksog8eifkMyaDjN9xtx4KEN9z5Tll2Y9Hf0-2BrPN9foPSQGgF3ctqGVF94-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;">
_______________________________________________<br>swift-evolution mailing list<br>swift-evolution@swift.org<br>https://lists.swift.org/mailman/listinfo/swift-evolution<br></div></div></span></blockquote></div><div class="bloop_markdown"><p></p></div></body></html>