Proposal to remove Existential Types from the language

Since the Java interface has type:

Key resolveSigningKey(JwsHeader header, Claims claims);

I think the correct signature for the override is just:

def resolveSigningKey(header: JwsHeader[_], claims: Claims): Key = ???

This works in Dotty but not in Scala 2 and I think Scala 2 is wrong here to force you to write this crazy existential type, for the same reason that if I declare a class Foo[X <: Int], I can write Foo[_] to talk about any Foo and it’s equivalent to writing Foo[_ <: Int], I should be able to write JwsHeader[_] without specifying a bound for the wildcard.

1 Like