Currently protocols can have the class constraint:
protocol MyProtocol : class {}
It would be (a) intuitive and (b) useful to allow such things as:
protocol Model : struct {} or protocol Event : enum {}
These types of restrictions can help prevent accidental anti-patterns or
misuse of APIs.
Seems simple and non-controversial... right?
[Note: I'd like to see even more heavy-handed protocol restrictions in the
future. For example, a protocol describing an enum with a common case, or
a struct with no reference members. Great stuff for defensively coding
APIs.]
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution