> 
> On Apr 28, 2016, at 11:05 AM, Xiaodi Wu <[email protected]> wrote:
> 
> How is retroactive modeling accommodated in this scheme? Say I want to 
> conform three types I don't own to a protocol of my design and supply a 
> default implementation for a protocol requirement. How would I go about it?

extension NotMyType: ProtocolIdesigned {...}

extension NotMyProtocol {
     required func method1() {...}
     override required func method2() {...} // assumes NMP has already provided 
default
     func newThing() {...}
}

The only tricky bit is when NotMyProtocol already has a default required func 
implementation and an override required func implementation (although that 
should be rare). In such case, you probably have to create a new protocol 
DerivedProtocol: NotMyProtocol and work from there. The override in the 
DerivedProtocol will then take priority over the override in NotMyProtocol.

-- E

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to