<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">That is exactly what I was thinking about back then when I posted this idea, but this doesn’t work, at least right now. I’m not sure if this will change if we’ll be forced to use `override` when there is a default implementation provided by the protocol. I’d hope for that behavior. Described here:&nbsp;https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#allowing-subclasses-to-override-requirements-satisfied-by-defaults-</div> <br> <div id="bloop_sign_1463602656836440064" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">--&nbsp;<br>Adrian Zubarev<br>Sent with Airmail</div></div> <br><p class="airmail_on">Am 18. Mai 2016 bei 21:21:40, Sean Heber 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>Putting “final” on a default method implementation that is inside of a protocol extension could maybe make some sense to prevent other implementations of that method, but final in the protocol itself doesn’t make sense to me.<br><br>l8r<br>Sean<br><br><br>&gt; On May 18, 2016, at 2:18 PM, Leonardo Pessoa via swift-evolution &lt;swift-evolution@swift.org&gt; wrote:<br>&gt; <br>&gt; Adrian, what would be the meaning of this final declaration? In my<br>&gt; understanding, a final means there can be no more overrides of that<br>&gt; method but there are no implementations in a protocol so I really<br>&gt; don't understand this use.<br>&gt; <br>&gt; On 18 May 2016 at 16:15, Matthew Johnson via swift-evolution<br>&gt; &lt;swift-evolution@swift.org&gt; wrote:<br>&gt;&gt; <br>&gt;&gt; On May 18, 2016, at 12:53 PM, Adrian Zubarev via swift-evolution<br>&gt;&gt; &lt;swift-evolution@swift.org&gt; wrote:<br>&gt;&gt; <br>&gt;&gt; I’d like to revive this idea I posted long time ago. There is only one thing<br>&gt;&gt; I need to update here:<br>&gt;&gt; <br>&gt;&gt; protocol MagicType: class /* missed the class constraint */ {<br>&gt;&gt; <br>&gt;&gt;    final var foo: Int { get }<br>&gt;&gt;    final func boo()<br>&gt;&gt; }<br>&gt;&gt; <br>&gt;&gt; What benefit is there in defining a protocol requirement as final?<br>&gt;&gt; <br>&gt;&gt; What do you guys think? Is there any technical reason why this is not<br>&gt;&gt; possible?<br>&gt;&gt; <br>&gt;&gt; --<br>&gt;&gt; Adrian Zubarev<br>&gt;&gt; Sent with Airmail<br>&gt;&gt; <br>&gt;&gt; Am 5. Dezember 2015 bei 16:26:23, Adrian Zubarev<br>&gt;&gt; (adrian.zubarev@devandartist.com) schrieb:<br>&gt;&gt; <br>&gt;&gt; Hello there,<br>&gt;&gt; <br>&gt;&gt; I wonder if it is a good idea to be able to finalize in protocols and<br>&gt;&gt; default implementations.<br>&gt;&gt; <br>&gt;&gt; Here is an example:<br>&gt;&gt; <br>&gt;&gt; protocol MagicType {<br>&gt;&gt; <br>&gt;&gt;    final var foo: Int { get }<br>&gt;&gt;    final func boo()<br>&gt;&gt; }<br>&gt;&gt; <br>&gt;&gt; class X: MagicType {<br>&gt;&gt; <br>&gt;&gt;    final var foo: Int {<br>&gt;&gt; <br>&gt;&gt;        return 42<br>&gt;&gt;    }<br>&gt;&gt; <br>&gt;&gt;    final func boo() {<br>&gt;&gt; <br>&gt;&gt;        print("magic")<br>&gt;&gt;    }<br>&gt;&gt; }<br>&gt;&gt; <br>&gt;&gt; class Y: X {<br>&gt;&gt; <br>&gt;&gt;    // can't override func boo or var foo in here<br>&gt;&gt; }<br>&gt;&gt; <br>&gt;&gt; //===================================================//<br>&gt;&gt; <br>&gt;&gt; protocol SomeType {}<br>&gt;&gt; <br>&gt;&gt; extension SomeType {<br>&gt;&gt; <br>&gt;&gt;    final func foo() {<br>&gt;&gt; <br>&gt;&gt;        print("Hello World")<br>&gt;&gt;    }<br>&gt;&gt; }<br>&gt;&gt; <br>&gt;&gt; class A: SomeType {}<br>&gt;&gt; <br>&gt;&gt; class B: SomeType {<br>&gt;&gt; <br>&gt;&gt;    /* this should raise an error, because the class B shouldn't */<br>&gt;&gt;    /* be able to override that function from SomeType */<br>&gt;&gt; <br>&gt;&gt;    func foo() {<br>&gt;&gt;        // do something else<br>&gt;&gt;    }<br>&gt;&gt; }<br>&gt;&gt; <br>&gt;&gt; How do you anticipate this would interact with retroactive modeling of types<br>&gt;&gt; which would conform the requirements of `SomeType` but also happen to have a<br>&gt;&gt; `foo` method?<br>&gt;&gt; <br>&gt;&gt; <br>&gt;&gt; <br>&gt;&gt; —<br>&gt;&gt; Regards Adrian<br>&gt;&gt; <br>&gt;&gt; _______________________________________________<br>&gt;&gt; swift-evolution mailing list<br>&gt;&gt; swift-evolution@swift.org<br>&gt;&gt; https://lists.swift.org/mailman/listinfo/swift-evolution<br>&gt;&gt; <br>&gt;&gt; <br>&gt;&gt; <br>&gt;&gt; _______________________________________________<br>&gt;&gt; swift-evolution mailing list<br>&gt;&gt; swift-evolution@swift.org<br>&gt;&gt; https://lists.swift.org/mailman/listinfo/swift-evolution<br>&gt;&gt; <br>&gt; _______________________________________________<br>&gt; swift-evolution mailing list<br>&gt; swift-evolution@swift.org<br>&gt; https://lists.swift.org/mailman/listinfo/swift-evolution<br><br>_______________________________________________<br>swift-evolution mailing list<br>swift-evolution@swift.org<br>https://lists.swift.org/mailman/listinfo/swift-evolution<br></div></div></span></blockquote></body></html>