I always wanted a way to make some protocol default implementations not 
overridable. Now Swift 3 got open vs. public behavior for classes. (Hopefully 
the inconsistency will be fixed soon and we’ll get open protocols as well.)

Imagine this scenario with open/public protocols.

// Module A
// `open protocol` means that in a diff. module I'll
// be able to conform to that protocol
open protocol Proto {}

extension Proto {
     // shouldn't this mean that the variable is not overridable  
     // from a different module? :)
     public var foo: Int { return 42 }

// Module B
struct A : Proto {
    // can I or can I not override `foo` from here?
I wonder if my thinking is correct here, or do we need something else to make 
extensions with default implementation to be fixed and not overridable?

Adrian Zubarev
Sent with Airmail
swift-users mailing list

Reply via email to