<https://kotlinlang.org/docs/reference/generics.ht...
# getting-started
f
I've already read up on it, I am trying to clarify my understanding with a question that I phrased very simple and straight forward on purpose
since this topic is quite difficult
s
imo the kotlin docs are the best way I’ve seen variance explained, at least, within an applied context.
moreover,
creating an
Array<out T>
means that I can pass subtypes of
T
?
is not a question with a yes/no answer -
pass
could mean a couple of things here, such as assignment, declaration, or invoking a function - all of which concern variance
that doc page describes the various ways
out
can affect a generic type and how you use it
f
I see, thanks
s
if you’re looking to learn more about covariance and contravariance, the wiki page on it isn’t bad, and provides plenty of further reading - but if you’re having a hard time grokking blog posts, then I’d say you should literally just try writing a generic class and seeing what you can and cannot do with those type projections
a toy linkedlist class or something similar would let you gain a bit more insight as to what the type system is trying to allow or prevent you from doing when using these markers