Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can all usages of `forSome` be replaced by an equivalent usage of `_`?

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?

like image 499
soc Avatar asked Feb 25 '12 17:02

soc


1 Answers

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

like image 193
oxbow_lakes Avatar answered Oct 20 '22 21:10

oxbow_lakes