[swift-evolution] Making protocol conformance inheritance controllable

Matthew Johnson matthew at anandabits.com
Mon Dec 14 22:37:14 CST 2015


> The problems in the motivating examples all center around protocols with factory methods or other uses of Self. Changing the behavior of all protocols seems like the wrong tool to solve that problem. There must be a narrower solution that improves those cases without changing so much existing code and understanding. (Are there any other languages with similar behavior?)

I had a Twitter exchange with Joe on this topic about a month ago as well.  It was also an initializer / factory method example where I was unable to write conformance for Foundation classes.

I mentioned the possible solution of allowing a protocol to specify something like Self that would be non-covarying.  I don't have any idea what a good name for this might but it would have worked for the problem I was trying to solve.   It is certainly a much narrower solution. 

Matthew

If I remember correctly he 


More information about the swift-evolution mailing list