<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: 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">-- <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>> On May 18, 2016, at 2:18 PM, Leonardo Pessoa via swift-evolution <swift-evolution@swift.org> wrote:<br>> <br>> Adrian, what would be the meaning of this final declaration? In my<br>> understanding, a final means there can be no more overrides of that<br>> method but there are no implementations in a protocol so I really<br>> don't understand this use.<br>> <br>> On 18 May 2016 at 16:15, Matthew Johnson via swift-evolution<br>> <swift-evolution@swift.org> wrote:<br>>> <br>>> On May 18, 2016, at 12:53 PM, Adrian Zubarev via swift-evolution<br>>> <swift-evolution@swift.org> wrote:<br>>> <br>>> I’d like to revive this idea I posted long time ago. There is only one thing<br>>> I need to update here:<br>>> <br>>> protocol MagicType: class /* missed the class constraint */ {<br>>> <br>>> final var foo: Int { get }<br>>> final func boo()<br>>> }<br>>> <br>>> What benefit is there in defining a protocol requirement as final?<br>>> <br>>> What do you guys think? Is there any technical reason why this is not<br>>> possible?<br>>> <br>>> --<br>>> Adrian Zubarev<br>>> Sent with Airmail<br>>> <br>>> Am 5. Dezember 2015 bei 16:26:23, Adrian Zubarev<br>>> (adrian.zubarev@devandartist.com) schrieb:<br>>> <br>>> Hello there,<br>>> <br>>> I wonder if it is a good idea to be able to finalize in protocols and<br>>> default implementations.<br>>> <br>>> Here is an example:<br>>> <br>>> protocol MagicType {<br>>> <br>>> final var foo: Int { get }<br>>> final func boo()<br>>> }<br>>> <br>>> class X: MagicType {<br>>> <br>>> final var foo: Int {<br>>> <br>>> return 42<br>>> }<br>>> <br>>> final func boo() {<br>>> <br>>> print("magic")<br>>> }<br>>> }<br>>> <br>>> class Y: X {<br>>> <br>>> // can't override func boo or var foo in here<br>>> }<br>>> <br>>> //===================================================//<br>>> <br>>> protocol SomeType {}<br>>> <br>>> extension SomeType {<br>>> <br>>> final func foo() {<br>>> <br>>> print("Hello World")<br>>> }<br>>> }<br>>> <br>>> class A: SomeType {}<br>>> <br>>> class B: SomeType {<br>>> <br>>> /* this should raise an error, because the class B shouldn't */<br>>> /* be able to override that function from SomeType */<br>>> <br>>> func foo() {<br>>> // do something else<br>>> }<br>>> }<br>>> <br>>> How do you anticipate this would interact with retroactive modeling of types<br>>> which would conform the requirements of `SomeType` but also happen to have a<br>>> `foo` method?<br>>> <br>>> <br>>> <br>>> —<br>>> Regards Adrian<br>>> <br>>> _______________________________________________<br>>> swift-evolution mailing list<br>>> swift-evolution@swift.org<br>>> https://lists.swift.org/mailman/listinfo/swift-evolution<br>>> <br>>> <br>>> <br>>> _______________________________________________<br>>> swift-evolution mailing list<br>>> swift-evolution@swift.org<br>>> 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><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>