@Blaisorblade To take the idea further, would type projections T#X
still be unsound if we looked only at the upper bound of X
in T
, and not at its lower bound? As in, if we had class T{ type X >: S <: String }
we could manipulate values of type T#X
as strings, but we could not, for example, give values of type S
to functions whose domain is T#X
.
I could see such restricted projections still being super useful.
4 Likes