[swift-evolution] Small Enhancement Request for Swift Protocol

Sreejith K R kr.srjith at gmail.com
Sat May 14 09:49:33 CDT 2016


Hello All,


I would like to suggest an enhancement for the swift protocol would really
like this feature to be reviewed.

Enhancement Description :

Currently it is not possible to invoke  the default implementation of a
particular protocol (EG: SampleProtocolParent achieved using protocol
extension)  inside   another protocol extention(Eg: SampleProtocolSub) that
inherits from the former protocol. Please look  into the SampleProtocolSub
extension as shown below. Also the same behavior is observed  while a class
implements the protocol(Please look  into the Test class that implements
SampleProtocolSub as shown below ).

 This behavior is something similar to the usage of super keyword while
overriding a method.

protocol SampleProtocolParent{
    func testFunction();

}
extension SampleProtocolParent{
    func testFunction(){
            print("hello my super implementation")
    }

}
protocol SampleProtocolSub:SampleProtocolParent{


}

extension SampleProtocolSub{
    func testFunction(){
       /* need to call testFunction implementation of the parent
SampleProtocolParent as well here. Is this a possible feature  ?*/
        print("hello my current and new implementation")
    }

}

class Test:SampleProtocolSub{
    func testFunction(){

        /* need to call testFunction implmentaion of the parent
SampleProtocolParent as well here. Is this a possible feature  ?*/
        print("hello my current and new new new implementaion")
    }
}

Thanks,
Sreejith K R
KonyDeveloperGroup
<http://www.linkedin.com/groups/Kony-Developers-Group-4981807?trk=my_groups-b-grp-v>
Mobile Dev Blog <http://http//ultimatemobiledev.blogspot.in>
Linkedin <http://in.linkedin.com/in/sreejithrajendran/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160514/c35ee35a/attachment-0001.html>


More information about the swift-evolution mailing list