So, I vaguely understand that a generic class declared with an “out” is a “producer” and if declared with an “in”, it is a “consumer”.
All in all, what I understand from this is that functions declared within the generic class can only either produce a result of type T (out), or take in as an argument a type T (in), but not both.
I also suppose this means that an “out” generic class is read-only, while an “in” generic class is write-only.
Why though are there restrictions on a property of type T?
Upon declaring a generic class of type <out T>, any vars of type T are marked as inappropriate. This, I can kind of understand, as “out” generics are “read-only”, and therefore wouldn’t support a var which could allow re-assigning or re-writing to the var variable.
But why can’t I use a val in a generic of <in T>? I don’t feel like I am producing anything when I have a val of type T.