For instance, List[T] forSome { type T }
is equivalent to List[_]
, but is this true for every possible usage of forSome
or are there cases where forSome
cannot be replaced by an equivalent of the second syntax?
No, not all usages can be thus converted. Something like this (thanks to retronym, below, who should be getting the upvotes on this one)
def foo(xs: Map[T, T] forSome { type T})
The point here is that I can use the existential in more than one place but it is the same existential. Obviously, if you used wildcards, you would be referring to different existentials
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With