<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>I’d be in favor if we could look at this topic further - <a href="https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#allowing-subclasses-to-override-requirements-satisfied-by-defaults-">Generics Manifesto: Allowing subclasses to override requirements satisfied by defaults</a>.</p>
<p>In my world this should look like this:</p>
<pre><code class="swift">protocol P {
func foo()
}
extension P {
func foo() { print("P") }
}
class C : P {
// gets the protocol extension's
// or override it
override func foo() {
// do your work or optionally call the default implementation
default.foo() // Notice how `default` suits here better than `super`
}
}
class D : C {
override func foo() {
// #1 - if `C` has not overridden `foo()`
print("D")
// or
default.foo()
// #2 - if `C` has overridden `foo()`
print("D") // ignore everything
// or call `super`
super.foo()
// or even `default`
default.foo()
}
}
</code></pre>
<p><code>C</code> does not necessarily need to be a class, that should be the same behavior for value types as well.</p>
<p>Additional to that we could make default implementations <code>final</code> so that you cannot override them from the conforming type at all.</p>
<p>Having this much of power and flexibility would be simply great.</p>
<p>Plus the mentioned behavior from the current thread should not even exist IMO. </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_1486758757810978816" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div> <br><p class="airmail_on">Am 10. Februar 2017 um 21:29:46, Anton Zhilin 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><div></div><div>
<title></title>
<div dir="ltr">
<div class="markdown-here-wrapper" style="">
<p style="margin:0px 0px 1.2em!important">I’d even suggest to force
<code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">
final</code> for such methods:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code class="hljs language-swift" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span class="hljs-class"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">protocol</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">Fooable</span> </span>{ }
<span class="hljs-class"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">extension</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">Fooable</span> </span>{
<span class="hljs-comment" style="color:rgb(153,153,136);font-style:italic">// func foo() { } // error: must be declared as final</span>
final <span class="hljs-func"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">func</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold">foo</span><span class="hljs-params">()</span> </span>{ } <span class="hljs-comment" style="color:rgb(153,153,136);font-style:italic">// ok</span>
}
</code></pre>
<div title="MDH:PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPkknZCBldmVuIHN1Z2dlc3QgdG8gZm9yY2UgYGZpbmFs YCBmb3Igc3VjaCBtZXRob2RzOjwvZGl2PjxkaXYgY2xhc3M9ImdtYWlsX2V4dHJhIj48YnI+PC9k aXY+PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPmBgYHN3aWZ0PC9kaXY+PGRpdiBjbGFzcz0iZ21h aWxfZXh0cmEiPnByb3RvY29sIEZvb2FibGUgeyB9PC9kaXY+PGRpdiBjbGFzcz0iZ21haWxfZXh0 cmEiPjxicj48L2Rpdj48ZGl2IGNsYXNzPSJnbWFpbF9leHRyYSI+ZXh0ZW5zaW9uIEZvb2FibGUg ezwvZGl2PjxkaXYgY2xhc3M9ImdtYWlsX2V4dHJhIj4vLyAmbmJzcDtmdW5jIGZvbygpIHsgfSAm bmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsvLyBlcnJvcjogbXVzdCBiZSBkZWNsYXJlZCBhcyBm aW5hbDwvZGl2PjxkaXYgY2xhc3M9ImdtYWlsX2V4dHJhIj4mbmJzcDsgJm5ic3A7IGZpbmFsIGZ1 bmMgZm9vKCkgeyB9ICZuYnNwOy8vIG9rPC9kaXY+PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPn08 L2Rpdj48ZGl2IGNsYXNzPSJnbWFpbF9leHRyYSI+YGBgPC9kaXY+" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">
</div>
</div>
</div>
_______________________________________________<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>