> A major difference from Java in Scala is, that container types are not-variant by default!<p>Only arrays are variant "by default" in java (which was a huge mistake). Variance for generic collections is specified at use, not at the type definition level.<p>> This means that if you have a container defined as Box[A], and then use it with a Fruit in place of the type parameter A, you will not be able to insert an Apple (which IS-A Fruit) into it.<p>No. What this really means is that you can't assign an instance of Box[Apple] to a val/var of type Box[Fruit].
The following has always had me a bit puzzled, be interested in responses.<p>If bottom type corresponds to no(thing) and top to any(thing) where does every(thing) and some(thing) fit in? Is there any semantic distinction between any(thing) and every(thing)? There should be, right? For me, some(thing) that had type any(thing) would be an _individual_ but some(thing) that had type every(thing) {actually the mind boggles a bit here} would be a _colection_, the collection of all existing or living things. In fact Ruby has the notion of Objectspace. So we can say things like ObjectSpace.each_object{|x| p x}
Calling those “types of types” is highly misleading. The term “type of types” has a very precise technical meaning: <a href="https://ncatlab.org/nlab/show/type+of+types" rel="nofollow">https://ncatlab.org/nlab/show/type+of+types</a>