[swift-evolution] [Pitch] separate syntax of class inheritance and protocol conformance

Tino Heth 2th at gmx.de
Fri Jul 22 09:28:03 CDT 2016

I have the feeling that there's to much stress right now to handle this pitch in the way it deserves… it might be better to do the split, but imho there is no obvious syntax for protocol conformance, so I expect a long discussion on the details.

Depending on how important protocols will become in the future, it could be really nice to have a separate namespace for them:
It would remove the need for a "protocol-suffix" (…Type), and it could even be feasible to automatically derive protocols from the interface of classes…
I'm not sure how useful this would be, but it would be much less work to build libraries that utilizes the flexibility of protocols.

You could create a algebra-library with a standard matrix-struct, but write the majority of the functions for a derived matrix-protocol, so that users can easily write their own implementations with custom memory-layout.
This would be especially useful as structs don't support inheritance right now, so if I want to create a SparseMatrix-struct, it is not possible to utilize all the hypothetical SimpleMatrix-methods (unless I create a protocol manually).

More information about the swift-evolution mailing list