[swift-evolution] Make generics covariant and add generics to protocols

Thorsten Seitz tseitz42 at icloud.com
Wed Jan 13 00:10:03 CST 2016

> Am 13.01.2016 um 04:08 schrieb Simon Pilkington via swift-evolution <swift-evolution at swift.org>:
> What uses do you see for covariance defined by the author of a type?

Just chiming in although I'm not David: you could have producer and consumer ointerfaces e.g. for collection types.

> Also I agree with you about Java; in particular for me the combination of covariance, Raw Types and Type Erasure create a very confusing system which sometimes seems to be of little benefit.

Yes, for most questions about the type system Java is a bad example...

Scala uses definition site variance annotations instead of use site annotations (like Java's wildcards). Ceylon actually does both but has a strong preference on definition site variance annotations, see http://ceylon-lang.org/documentation/1.2/tour/generics/


More information about the swift-evolution mailing list