Is there a difference in scala type bound notation direction, as in is [B <: A] the same as [A >: B]?
Is there a difference in scala type bound notation direction?
119 Views Asked by Caballero At
2
Is there a difference in scala type bound notation direction, as in is [B <: A] the same as [A >: B]?
B <: Ameans thatBhas an upper-bound ofA. Which means thatBcan be any type fromNothingtoAin the type hierarchy.A >: Bmeans thatAhas a lower-bound ofB, which means thatAcan be anything fromBtoAnyin the type hierarchy.In general, they do not mean the same thing. Each one imposes a bound on a different type parameter. This isn't variance notation either, these are type bounds.